Skip to content

Emit MCP tool output schemas - #6780

Merged
tim-smart merged 3 commits into
mainfrom
agent/codex-engineer/370ca635
Jul 30, 2026
Merged

Emit MCP tool output schemas#6780
tim-smart merged 3 commits into
mainfrom
agent/codex-engineer/370ca635

Conversation

@tim-smart

Copy link
Copy Markdown
Contributor

Summary

  • add optional MCP tool output schemas to tools/list
  • omit outputSchema for tools without typed success schemas
  • cover typed and untyped tools in the MCP server tests

Testing

  • pnpm --filter effect test --run test/unstable/ai/McpServer.test.ts
  • pnpm lint-fix
  • pnpm check
  • git diff --check

Closes EFF-226
Closes #6753

@github-project-automation github-project-automation Bot moved this to Discussion Ongoing in PR Backlog Jul 30, 2026
@changeset-bot

changeset-bot Bot commented Jul 30, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 63cd95a

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 29 packages
Name Type
effect Patch
@effect/opentelemetry Patch
@effect/platform-browser Patch
@effect/platform-bun Patch
@effect/platform-deno Patch
@effect/platform-node-shared Patch
@effect/platform-node Patch
@effect/vitest Patch
@effect/ai-anthropic Patch
@effect/ai-openai-compat Patch
@effect/ai-openai Patch
@effect/ai-openrouter Patch
@effect/atom-react Patch
@effect/atom-solid Patch
@effect/atom-vue Patch
@effect/sql-clickhouse Patch
@effect/sql-d1 Patch
@effect/sql-libsql Patch
@effect/sql-mssql Patch
@effect/sql-mysql2 Patch
@effect/sql-pg Patch
@effect/sql-pglite Patch
@effect/sql-sqlite-bun Patch
@effect/sql-sqlite-do Patch
@effect/sql-sqlite-node Patch
@effect/sql-sqlite-react-native Patch
@effect/sql-sqlite-wasm Patch
@effect/docgen Patch
@effect/openapi-generator Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@effect-slopcop effect-slopcop Bot added 4.0 enhancement New feature or request labels Jul 30, 2026
name: tool.name,
description: Tool.getDescription(tool),
inputSchema: Tool.getJsonSchema(tool),
...(tool.successSchema === Schema.Void || tool.successSchema === Schema.Unknown ? {} : {

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should check the ast instead of comparing against the schema instances

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually I think every tool has a valid success schema, so we could always include outputSchema. Validate this against the mcp spec first before changing anything.

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ No new issues found.

Reviewed changes

  • outputSchema field on McpSchema.Tool — optional JSON Schema describing the tool's output, omitted when the tool has no typed success schema
  • registerToolkit emits outputSchema — computes and spreads outputSchema for tools whose successSchema is neither Schema.Void nor Schema.Unknown
  • Test for typed vs untyped — adds an UntypedTool (defaulting to Schema.Void) and a test asserting outputSchema appears only for typed tools

Pullfrog  | View workflow run | Using DeepSeek Pro (free via Pullfrog for OSS) (Kimi K2 not used — the program covers this model; add its provider key to run your pick) | 𝕏

@github-actions

Copy link
Copy Markdown
Contributor

Bundle Size Analysis

Generated from PR build output; treat the content below as untrusted.

File Name Current Size Previous Size Difference
basic.ts 6.63 KB 6.63 KB 0.00 KB (0.00%)
batching.ts 9.42 KB 9.42 KB 0.00 KB (0.00%)
brand.ts 6.31 KB 6.31 KB 0.00 KB (0.00%)
cache.ts 10.12 KB 10.12 KB 0.00 KB (0.00%)
config.ts 19.90 KB 19.90 KB 0.00 KB (0.00%)
differ.ts 20.03 KB 20.03 KB 0.00 KB (0.00%)
http-client.ts 20.94 KB 20.94 KB 0.00 KB (0.00%)
logger.ts 10.28 KB 10.28 KB 0.00 KB (0.00%)
metric.ts 8.55 KB 8.55 KB 0.00 KB (0.00%)
optic.ts 7.33 KB 7.33 KB 0.00 KB (0.00%)
pubsub.ts 14.26 KB 14.26 KB 0.00 KB (0.00%)
queue.ts 11.09 KB 11.09 KB 0.00 KB (0.00%)
schedule.ts 10.27 KB 10.27 KB 0.00 KB (0.00%)
schema-class.ts 18.86 KB 18.86 KB 0.00 KB (0.00%)
schema-fromJsonSchemaDocument.ts 28.78 KB 28.78 KB 0.00 KB (0.00%)
schema-representation-roundtrip.ts 25.09 KB 25.09 KB 0.00 KB (0.00%)
schema-string-transformation.ts 12.95 KB 12.95 KB 0.00 KB (0.00%)
schema-string.ts 10.65 KB 10.65 KB 0.00 KB (0.00%)
schema-template-literal.ts 14.85 KB 14.85 KB 0.00 KB (0.00%)
schema-toArbitraryLazy.ts 21.66 KB 21.66 KB 0.00 KB (0.00%)
schema-toCodeDocument.ts 24.10 KB 24.10 KB 0.00 KB (0.00%)
schema-toCodecJson.ts 19.00 KB 19.00 KB 0.00 KB (0.00%)
schema-toEquivalence.ts 18.73 KB 18.73 KB 0.00 KB (0.00%)
schema-toFormatter.ts 18.59 KB 18.59 KB 0.00 KB (0.00%)
schema-toJsonSchemaDocument.ts 22.23 KB 22.23 KB 0.00 KB (0.00%)
schema-toRepresentation.ts 19.27 KB 19.27 KB 0.00 KB (0.00%)
schema.ts 18.12 KB 18.12 KB 0.00 KB (0.00%)
stm.ts 12.05 KB 12.05 KB 0.00 KB (0.00%)
stream.ts 9.37 KB 9.37 KB 0.00 KB (0.00%)

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ No new issues found.

Reviewed changes

  • Fixed Schema.Void / Schema.Unknown check to use AST type guards — switched from === reference equality to SchemaAST.isVoid / SchemaAST.isUnknown in registerToolkit, so annotated schemas like Schema.Void.annotate({ description: "No output" }) are correctly treated as void
  • Added AnnotatedVoidTool test coverage — new test tool with Schema.Void.annotate(...) and assertions confirming it omits outputSchema just like an unadorned void tool

Pullfrog  | View workflow run | Using DeepSeek Pro (free via Pullfrog for OSS) (Kimi K2 not used — the program covers this model; add its provider key to run your pick) | 𝕏

@tim-smart
tim-smart enabled auto-merge (squash) July 30, 2026 04:13

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ No new issues found.

Reviewed changes

  • Narrowed outputSchema gating to object-type schemas only — switched from "exclude void/unknown schemas" to "only include schemas whose JSON Schema type is "object"", so scalar tools like Schema.String no longer emit outputSchema
  • Added StructuredResultTool test — exercises a Schema.Struct tool and verifies the full object output schema with properties, required, and additionalProperties
  • Added scalar-omission assertion — verifies OptionalStringTool (scalar) does not get an outputSchema field, confirming the new type === "object" gate

Pullfrog  | View workflow run | Using DeepSeek Pro (free via Pullfrog for OSS) (Kimi K2 not used — the program covers this model; add its provider key to run your pick) | 𝕏

@tim-smart
tim-smart merged commit c96b7f6 into main Jul 30, 2026
16 checks passed
@tim-smart
tim-smart deleted the agent/codex-engineer/370ca635 branch July 30, 2026 04:18
@github-project-automation github-project-automation Bot moved this from Discussion Ongoing to Done in PR Backlog Jul 30, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

4.0 enhancement New feature or request

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

McpServer: tools/list does not emit outputSchema for tools with a typed success schema

1 participant