Schema validation reuses the first schema registered under a $id: a changed outputSchema or a second tool with the same $id is validated against the wrong schema
Los mantenedores suelen responder en 1 día
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 4/5
- Tiempo estimado
- 3-5 días
- Aptitud para principiantes
- 68/100
- Tipo de issue
- Error
- Claridad
- Bien especificado
- Estado de actividad
- Activo
- Stack tecnológico
- typescript
- Área
- testing-qa
Línea de trabajo
Start by reading LinearPatternJsonSchemaValidator.getValidator and trace how its schema engine handles $id when schemas are compiled or reused. Reproduce both cases from the issue, then check the validator tests for coverage. Done means each call validates against the schema passed to it, including after a schema changes while retaining its $id.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
Which version line?
v2 — current (@modelcontextprotocol/inspector@latest)
Which client?
All / shared core
Inspector version
2.14.0 (released package; also v2/main @ 3b387d3)
Node version
v22.23.4
Operating system (and browser, for the web client)
Linux (Debian)
Transport
Not applicable / never connected
MCP server under inspection
Any server whose tool outputSchema (or an elicitation requestedSchema) carries a $id. Reproduced directly against LinearPatternJsonSchemaValidator, which InspectorClient shares for the client's lifetime.
Steps to reproduce
getValidator does engine.getSchema(id) ?? engine.compile(schema) whenever the schema has a string $id, so whatever was first registered under that $id wins.
Case 1: tool output schema changes (e.g. after notifications/tools/list_changed) but keeps its $id:
const v = new LinearPatternJsonSchemaValidator();
const before = { $id: "urn:example:weather-output", type: "object",
properties: { temp: { type: "number" } }, required: ["temp"] };
const after = { $id: "urn:example:weather-output", type: "object",
properties: { temp: { type: "string", pattern: "^-?\\d+C$" } }, required: ["temp"] };
v.getValidator(before)({ temp: 21 });
v.getValidator(after)({ temp: "21C" }); // conforms to the new schema
v.getValidator(after)({ temp: 21 }); // violates the new schema
Case 2: two tools declare the same $id (e.g. a generic "output"):
v.getValidator({ $id: "output", type: "object", required: ["a"] })({ a: 1 });
v.getValidator({ $id: "output", type: "object", required: ["b"] })({ b: 1 });
Expected behavior
Each call validates against the schema passed in: case 1 accepts "21C" and rejects 21; case 2 accepts { b: 1 }.
Actual behavior
Validated against the first schema registered under the $id:
- case 1:
{ temp: "21C" }→data/temp must be number(false failure);{ temp: 21 }→ valid (false pass) - case 2:
{ b: 1 }→data must have required property 'a'
For an inspector, both directions matter: a server developer who fixes an outputSchema keeps seeing results checked against the old one until the client is recreated, and a non-conforming result passes.
Logs, errors, or screenshots
The same getSchema($id) ?? compile shape is in the SDK's AjvJsonSchemaValidator.getValidator (@modelcontextprotocol/client ajvProvider), which the Inspector used directly before 2.14, so this likely predates 2.14 and was carried into the 2.14 copy. Related SDK issue on the no-$id path: modelcontextprotocol/typescript-sdk#2605.
Already prototyped a fix?
Not a PR. Possible fix: only reuse getSchema(id) when the registered schema is deep-equal to the one passed in; otherwise removeSchema(id) and compile the new one (or key reuse on a stable hash of the schema rather than $id).
Before you submit
- I searched existing issues and this is not a duplicate.
- This is not a security vulnerability report (those go through the private advisory process).
- Lenguaje dominante
- TypeScript
- Estrellas
- 11.3k
- Forks
- 1.6k
- Merge medio
- 1 h 28 min
- PR fusionados (30 d)
- 138
Preparar el entorno
- Incluye un Dockerfile o un archivo de Docker Compose
- Tiene una plantilla de pull request
- Leer la guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de modelcontextprotocol/inspector
-
enhancement v2
Dificultad 5/5 Más de una semana Aptitud para principiantes 15/100
modelcontextprotocol/inspector#2936 · 2 comentarios ·
Los mantenedores suelen responder en 1 día
-
bug v2
Dificultad 4/5 1-2 días Aptitud para principiantes 48/100
modelcontextprotocol/inspector#2934 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
chore v2
Dificultad 4/5 3-5 días Aptitud para principiantes 53/100
modelcontextprotocol/inspector#2922 ·
Los mantenedores suelen responder en 1 día
-
Document load testing and Active Sessions on modelcontextprotocol.ioPosiblemente ocupada @cliffhall la tomó hace 6 días. Abiertodocumentation v2 waiting-on-docs
modelcontextprotocol/inspector#2869 · 2 comentarios · 1 asignado ·
Los mantenedores suelen responder en 1 día
-
CLI: OAuth denials and other non-usage failures exit 1 with code "error", the same as a usage errorAbiertobug v2
Dificultad 3/5 1-2 días Aptitud para principiantes 68/100
modelcontextprotocol/inspector#2842 · 5 comentarios ·
Los mantenedores suelen responder en 1 día
Todos los issues de modelcontextprotocol/inspector
Issues similares
-
[Bug]: t3 connect status reports "Exposure: enabled" for publish-only links without a tunnelAbierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 82/100
Los mantenedores suelen responder en 1 día
-
bug
Dificultad 2/5 1-3 horas Aptitud para principiantes 83/100
awslabs/visual-asset-management-system#1278 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 67/100
mifi/lossless-cut#3213 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 1/5 Menos de una hora Aptitud para principiantes 83/100
plasma-umass/scalene#1123 ·
Los mantenedores suelen responder en 1 día