fix: reorder variation variable union types and improve MCP descriptions for correct JSON typing#559
Conversation
8c880e9 to
90ad2e5
Compare
Deploying with
|
| Status | Name | Latest Commit | Updated (UTC) |
|---|---|---|---|
| ✅ Deployment successful! View logs |
devcycle-mcp-server | 9afc61f | Mar 13 2026, 02:50 PM |
There was a problem hiding this comment.
Pull request overview
This PR adjusts the advertised JSON Schema / MCP tool documentation for variation variables to better steer MCP tool callers toward using native JSON booleans/numbers (instead of string-encoding), addressing user-reported failures when the DevCycle API expects typed variable values.
Changes:
- Reorders the Zod union member ordering for variation
variablesacross multiple variation DTOs (to changeanyOfordering in generated JSON Schema). - Expands MCP tool argument descriptions to explicitly instruct using native JSON types (with examples) when populating variation
variables.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 4 comments.
| File | Description |
|---|---|
src/mcp/types.ts |
Updates tool argument descriptions for variations/variables to explicitly request native JSON typing and provide examples. |
src/api/zodSchemas.ts |
Reorders union type members for variation variables to prioritize boolean/number before string in generated schema output. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
You can also share your feedback on Copilot code review. Take the survey.
90ad2e5 to
33c2e65
Compare
…ons for correct JSON typing
33c2e65 to
9afc61f
Compare
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
You can also share your feedback on Copilot code review. Take the survey.
| 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( |
| 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" }' |
Summary
variablesto putbooleanandnumberbeforestringacross all 5 variation schemasMotivation
Users reported that creating/updating features with boolean variation variables via MCP fails with:
The root cause is that AI models send
"true"(string) instead oftrue(boolean) when calling the MCP tools. No serialization bug exists in our code — the issue is AI model behavior. Our Zod validation accepts"true"becausez.string()matches beforez.boolean()is tried, so the error only surfaces when the DevCycle API rejects the request.Changes
src/api/zodSchemas.ts— Reordered union from[string, number, boolean, ...]to[boolean, number, string, ...]inCreateVariationDto,Variation,UpdateVariationDto,FeatureVariationDto, andUpdateFeatureVariationDto. This changes theanyOforder in the advertised JSON Schema. It's a loose theory that havingstringfirst inanyOfinfluences models to default to string encoding — worth trying but not guaranteed to fix the issue on its own.src/mcp/types.ts— Enhanced descriptions onCreateFeatureArgsSchema.variations,UpdateFeatureArgsSchema.variations, and the sharedvariablesDescriptionused by standalone variation tools. Descriptions now explicitly state to use native JSON types with examples. This is likely the more impactful change since models tend to follow explicit instructions in tool descriptions.