Skip to content

fix: catch tool registration errors#155

Merged
cdcabrera merged 2 commits intopatternfly:mainfrom
cdcabrera:20260409-mcpsdk
Apr 21, 2026
Merged

fix: catch tool registration errors#155
cdcabrera merged 2 commits intopatternfly:mainfrom
cdcabrera:20260409-mcpsdk

Conversation

@cdcabrera
Copy link
Copy Markdown
Member

@cdcabrera cdcabrera commented Apr 9, 2026

What is it?

  • fix: catch tool registration errors
    • docs, add terms, definitions for JSON, Zod, raw Zod
    • index, annotate JSON inputSchema, tools-as-plugins
    • server.schemas, normalizeInputSchema, add setting, allow returning undefined
    • server.tools, makeProxyCreators, use defensive normalizeInputSchema
    • server, try-catch tool registration, skip tools without zod schemas

Notes

  • build(deps): bump @modelcontextprotocol/sdk from 1.27.1 to 1.28.0 #154 released a potential breaking change as "fix." patch potential fail point
  • this work can go in before or after since it's applying logic
  • pf mcp already attempts to convert the json schema to a zod schema (zod released a feature to do this type of conversion) for "tools as plugins". we do not perform this zod conversion for internal tools, it is expected you use a zod/raw zod (zod-like) object.
    • this is a fallback for one-off scenarios where a non-zod schema manages to get through to registration
    • we now log and skip the tool registration
    • we wrap the registration in a try/catch for a smoother consumer experience
  • mcp sdk 1.28.0 still seems to allow a "zod-like" input schema, this may become stricter in the future and would require us to potentially tighten checks more
  • work includes a minor refactor and expanded unit testing of the schema normalization logic to support both strict Zod internal tools and flexible JSON-based external plugins.

Updates issue/story

ongoing

caused by #154

* docs, add terms, definitions for JSON, Zod, raw Zod
* index, annotate JSON inputSchema, tools-as-plugins
* server.schemas, normalizeInputSchema, add setting, allow returning undefined
* server.tools, makeProxyCreators, use defensive normalizeInputSchema
* server, try-catch tool registration, skip tools without zod schemas
@cdcabrera cdcabrera marked this pull request as ready for review April 21, 2026 13:53
@cdcabrera cdcabrera merged commit 934f7c7 into patternfly:main Apr 21, 2026
3 checks passed
@cdcabrera cdcabrera mentioned this pull request Apr 24, 2026
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