Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 10 additions & 10 deletions src/api/zodSchemas.ts
Original file line number Diff line number Diff line change
Expand Up @@ -700,9 +700,9 @@ export const CreateVariationDto = z.object({
variables: z
.record(
z.union([
z.string(),
z.number(),
z.boolean(),
z.number(),
z.string(),
z.array(z.unknown()),
z.record(z.unknown()),
]),
Expand Down Expand Up @@ -748,9 +748,9 @@ export const Variation = z.object({
variables: z
.record(
z.union([
z.string(),
z.number(),
z.boolean(),
z.number(),
z.string(),
z.array(z.unknown()),
z.record(z.unknown()),
]),
Expand Down Expand Up @@ -861,9 +861,9 @@ const UpdateVariationDto = z
variables: z
.record(
z.union([
z.string(),
z.number(),
z.boolean(),
z.number(),
z.string(),
z.array(z.unknown()),
z.record(z.unknown()),
]),
Expand Down Expand Up @@ -960,9 +960,9 @@ export const FeatureVariationDto = z.object({
variables: z
.record(
z.union([
z.string(),
z.number(),
z.boolean(),
z.number(),
z.string(),
z.array(z.unknown()),
z.record(z.unknown()),
]),
Expand All @@ -980,9 +980,9 @@ export const UpdateFeatureVariationDto = z
name: z.string().min(1).max(100),
variables: z.record(
z.union([
z.string(),
z.number(),
z.boolean(),
z.number(),
z.string(),
z.array(z.unknown()),
z.record(z.unknown()),
]),
Expand Down
12 changes: 8 additions & 4 deletions src/mcp/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@ import {
} from '../api/zodSchemas'
import { UpdateFeatureStatusDto } from '../api/schemas'

const VARIATION_VARIABLES_TYPE_HINT =
'Variable values must use native JSON types: true/false for booleans, numbers for numeric values, strings only for string values. e.g. { "boolVar": false, "numVar": 42, "stringVar": "value" }'

// Zod schemas for MCP tool arguments
export const VariableValidationSchema = z.object({
schemaType: z
Expand Down Expand Up @@ -277,7 +280,7 @@ export const CreateFeatureArgsSchema = CreateFeatureDto.extend({
'Environment-specific configurations (key-value map of environment keys to config)',
),
variations: CreateFeatureDto.shape.variations.describe(
'Array of variations for this feature',
`Array of variations for this feature. ${VARIATION_VARIABLES_TYPE_HINT}`,
),
controlVariation: CreateFeatureDto.shape.controlVariation.describe(
Comment on lines 282 to 285
'The key of the variation that is used as the control variation for Metrics',
Expand Down Expand Up @@ -308,7 +311,9 @@ export const UpdateFeatureArgsSchema = UpdateFeatureDto.extend({
.describe('Updated array of variables for this feature'),
variations: UpdateFeatureDto.shape.variations
.optional()
.describe('Updated array of variations for this feature'),
.describe(
`Updated array of variations for this feature. ${VARIATION_VARIABLES_TYPE_HINT}`,
),
settings: UpdateFeatureDto.shape.settings
.optional()
.describe('Updated feature-level settings configuration'),
Expand Down Expand Up @@ -370,8 +375,7 @@ export const ListVariationsArgsSchema = z.object({
feature_key: z.string().describe('Feature key to list variations for'),
})

const variablesDescription =
'key-value map of variable keys to their values for this variation. { "variableKey1": "value1", "variableKey2": false }'
const variablesDescription = `key-value map of variable keys to their values for this variation. ${VARIATION_VARIABLES_TYPE_HINT}`

export const CreateVariationArgsSchema = CreateVariationDto.extend({
feature_key: z.string().describe('Feature key to create variation for'),
Expand Down
Loading