Commit 0660362
committed
fix(tool-helpers): use Zod's toJSONSchema() and MCP SDK types
Previously, json/any ports were incorrectly forced to type: 'object' in
MCP tool schemas. This fix uses Zod's built-in toJSONSchema() method
which correctly handles all types:
- z.any() → {} (empty schema = any JSON value)
- z.union([...]) → { anyOf: [...] }
- z.enum([...]) → { type: 'string', enum: [...] }
- z.literal('X') → { type: 'string', const: 'X' }
- z.record(...) → { type: 'object', additionalProperties: {...} }
Changes:
- Use @modelcontextprotocol/sdk for official Tool types
- ToolInputSchema now derives from Tool['inputSchema']
- Simplified code by reusing existing getActionInputIds()
- Removed redundant helper functions
Fixes P2 bug in PR #207
Signed-off-by: betterclever <[email protected]>1 parent 11c850d commit 0660362
File tree
4 files changed
+177
-91
lines changed- packages/component-sdk
- src
- __tests__
4 files changed
+177
-91
lines changed
0 commit comments