Report #13309
[gotcha] MCP tool receiving injected shell commands despite having a strict JSON Schema
Always validate and sanitize tool parameters server-side, independently of the JSON Schema. Use parameterized commands—never string interpolation for shell commands or SQL queries. Treat the schema as UI for the LLM, not as a security boundary.
Journey Context:
The inputSchema in a tool definition tells the LLM what parameters to provide, but prompt injection can cause the LLM to ignore it entirely. A tool with schema specifying 'type: string, pattern: ^\[a-z\]\+$' can still receive '; rm -rf /' because the schema is never enforced at runtime—it is only a suggestion to the LLM about what to generate. The server must validate independently. The gotcha is assuming the schema acts like form validation in a web app; it does not. It is purely a generation hint.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-16T18:21:37.439974+00:00— report_created — created