Skip to content

fix(schema): MCP-compatible structured output and schema generation#10

Merged
dankelleher merged 5 commits intomainfrom
fix/strip-none-structured-output
Feb 12, 2026
Merged

fix(schema): MCP-compatible structured output and schema generation#10
dankelleher merged 5 commits intomainfrom
fix/strip-none-structured-output

Conversation

@dankelleher
Copy link
Member

@dankelleher dankelleher commented Feb 12, 2026

Summary

  • Strip None values from structured output to avoid MCP anyOf validation errors
  • Remove user_email from all output models (redundant — caller already knows their email)
  • Centralize generate_schema() in core/structured_output.py with anyOf stripping
  • Remove auto-injected params (user_google_email, service) from tool docstrings
  • Regenerate all tool schemas
  • Fix tests to unpack (text, structured) tuples from _impl functions

user_google_email and service are auto-injected by the
require_google_service decorator and not exposed as tool inputs.
Documenting them in Args sections confuses MCP clients into
thinking they are required input parameters.
…generation

- Remove user_email field from all structured output dataclasses (contacts, calendar)
  since the caller already knows their own email
- Centralize generate_schema() in core/structured_output.py using Pydantic TypeAdapter
  with anyOf stripping for MCP compatibility
- Add _coerce_none() to strip None values from structured output before validation
- Fix _coerce_none reference in create_tool_result (was still using old _strip_none name)
- Fix tests to unpack (text, structured) tuples from _impl functions
@dankelleher dankelleher merged commit eb05077 into main Feb 12, 2026
2 checks passed
@dankelleher dankelleher deleted the fix/strip-none-structured-output branch February 12, 2026 09:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant