anomalyco / anomalyco/opencode

mcp: tool schemas omit required when additionalProperties is false

Open
#45,245 2 comments 0 reactions 1 assignee View on GitHub

@neriousy is already working on this.

Since Aug 26, 2026.

Dominant language
TypeScript
Stars
209k
Forks
27.5k
PR merge metrics
PR metrics pending

Description

Description

MCP tools advertised to the model set additionalProperties: false without a required array.

McpCatalog.convertTool copies the server schema and then forces additionalProperties: false. If the server omitted required (common for all-optional objects), the wire schema has properties but no required field. Strict OpenAI-compatible validators reject that with errors like 'required' is required to be supplied and to be an array.

The same shape is used for list_mcp_resources / list_mcp_resource_templates, which have an optional server property, additionalProperties: false, and no required.

read_mcp_resource already sets required: ["server", "uri"].

Plugins

None

OpenCode version

dev (c7134cb)

Steps to reproduce
  1. Convert an MCP tool whose inputSchema is { type: "object", properties: { server: { type: "string" } } } (no required).
  2. Inspect the schema sent to the model: additionalProperties: false, required missing.
  3. Send that schema to a strict OA-compat validator (Console Go / Codex).
Screenshot and/or share link

No response

Operating System

Linux

Terminal

n/a (unit-level)

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.