ADR 07: Plugin Output Schema — Validation as Warning, Not Error
Context
Plugin tools (both core and MCP-based) declare what structure their output takes via an optional outputSchema. This schema could theoretically be used to gate the LLM from receiving malformed tool results, but strict rejection would break workflows whenever a tool returns slightly different output than its schema declared — a common situation during plugin development or when wrapping third-party APIs.
Decision
Output schema validation is advisory only:
- Declaration:
CoreToolDefinition.outputSchema?: z.ZodTypeAny(core tools) andMcpToolSchema.outputSchema?(MCP/plugin tools) carry the schema. ThePluginSDKserialises it to JSON Schema intools/listandinitializeresponses so LLMs can reason about expected output shape. - Runtime check: After
executeSingleToolreturns, ifoutputSchemais present we runschema.safeParse(output). On failure we calllogger.warn(...)— the result is still passed to the LLM unchanged. - No error thrown: Validation failures never abort the tool call or return an error to the LLM. The warning lands in the logger for developer visibility without disrupting the running conversation.
Consequences
- Permissive by default: Plugin authors can declare schemas incrementally; mismatches surface as log warnings rather than hard failures, reducing friction during development.
- LLM-side benefit: When the LLM receives tool schemas it can generate more accurate downstream calls or format its summaries to match the expected structure.
- Auditability: Warning logs let operators detect schema drift between plugin versions without requiring schema enforcement in production.