v0.9.0-beta.9: MCP number coercion fix + modifyOrder safety#100
Merged
luokerenx4 merged 3 commits intomasterfrom Apr 3, 2026
Merged
v0.9.0-beta.9: MCP number coercion fix + modifyOrder safety#100luokerenx4 merged 3 commits intomasterfrom
luokerenx4 merged 3 commits intomasterfrom
Conversation
…ding Alpaca: add null guards before UNSET_DOUBLE comparisons on lmtPrice, auxPrice, trailingPercent — prevents sending undefined to exchange API. CCXT: add null guard on lmtPrice, forward auxPrice/trailStopPrice/ trailingPercent/tif via params object to editOrder. MockBroker: extend modifyOrder to handle trailStopPrice, trailingPercent, orderType, tif fields. TDD: 7 new tests (3 Alpaca + 4 CCXT) verify correct field isolation. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
MCP SDK validates tool inputs with strict Zod parse before the handler runs. When MCP clients send "80" (string) instead of 80 (number), the call fails with -32602. Both mcp.ts and tool-bridge.ts had duplicated code (toMcpContent, .shape extraction, execute wrapper) and the same missing coercion. Add core/mcp-export.ts as the single Vercel→MCP bridge: - extractMcpShape(): extracts Zod shape + coerces number fields (z.number() → z.coerce.number(), preserving all refinements) - wrapToolExecute(): shared try/catch + content conversion - toMcpContent(): deduplicated from both consumers Tool definitions stay strict; coercion only at the MCP boundary. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
3 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
"80"instead of80) caused Zod -32602 errors. Extract sharedcore/mcp-export.tswithz.coerce.number()at the MCP boundary.undefinedfields to exchange API due to missing null guards. CCXTeditOrderlacked auxPrice/tif/trailing field forwarding.Test plan
🤖 Generated with Claude Code