Bug Description
When an MCP server returns outputSchema in its tools/list response, opencode shows "Failed to get tools" and the server becomes unusable. The outputSchema field is valid per MCP spec (protocol version 2025-06-18).
Steps to Reproduce
- Configure an MCP server that returns tools with
outputSchema in the tool definition
- Start opencode
- Observe "Failed to get tools" for that server
Expected Behavior
Tools should load successfully. opencode doesn't use outputSchema — it only reads inputSchema in convertMcpTool().
Actual Behavior
The entire listTools() call fails because cacheToolMetadata() calls AjvJsonSchemaValidator.getValidator(tool.outputSchema), and if AJV can't compile the schema (unsupported keywords, complex schemas), it throws an unhandled error.
Root Cause
AjvJsonSchemaValidator.getValidator() in the MCP SDK calls ajv.compile(schema) with no try/catch. The error propagates through listTools() → caught by opencode's defs() → returns undefined → "Failed to get tools".
Environment
- opencode version: latest (dev branch)
- MCP SDK: v1.27.1
- OS: any
Bug Description
When an MCP server returns
outputSchemain itstools/listresponse, opencode shows "Failed to get tools" and the server becomes unusable. TheoutputSchemafield is valid per MCP spec (protocol version 2025-06-18).Steps to Reproduce
outputSchemain the tool definitionExpected Behavior
Tools should load successfully. opencode doesn't use
outputSchema— it only readsinputSchemainconvertMcpTool().Actual Behavior
The entire
listTools()call fails becausecacheToolMetadata()callsAjvJsonSchemaValidator.getValidator(tool.outputSchema), and if AJV can't compile the schema (unsupported keywords, complex schemas), it throws an unhandled error.Root Cause
AjvJsonSchemaValidator.getValidator()in the MCP SDK callsajv.compile(schema)with no try/catch. The error propagates throughlistTools()→ caught by opencode'sdefs()→ returnsundefined→ "Failed to get tools".Environment