Skip to content

MCP gateway doesn't enforce all of a tool's published input schema #8575

Open

Description

@cstns

platform_export_snapshot declares components.envVars as "all" | "keys" | false, and the published JSON Schema says exactly that:

"envVars": { "anyOf": [
  { "type": "string", "enum": ["all", "keys"] },
  { "type": "boolean", "const": false }
]}

Passing components: {envVars: true} sails past the gateway anyway and reaches the route, which bounces it as a bare Bad Request with no indication of which field was wrong.

Other keywords are enforced fine, so this looks specific rather than general:

  • additionalProperties: components: {nodes: false} is caught, Input validation error: ... components.nodes: unrecognized key
  • minLength: platform_update_snapshot declares name as z.string().min(1), and name: "" is caught, Input validation error: ... name: shorter than minLength 1
  • pattern: platform_set_instance_device_target declares hostedInstanceId as a UUID, and a non-UUID is caught, Input validation error: ... hostedInstanceId: does not match pattern ^([0-9a-fA-F]{8}-...
  • const on that boolean branch: not caught

Fallout is small on its own (the route catches it), but it means a tool can't fully rely on its declared schema for validation, and the agent gets a vague error instead of one naming the field. Related to #8572, which is about how errors come back rather than which ones get caught.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

area:aiAI relatedtype:bugSomething isn't working

Type

No type

Projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions