fix: correct cleared and flagColor schema types in CreateTransactionTool#27
Open
jdmadison wants to merge 1 commit into
Open
fix: correct cleared and flagColor schema types in CreateTransactionTool#27jdmadison wants to merge 1 commit into
jdmadison wants to merge 1 commit into
Conversation
The `cleared` field was typed as `z.boolean()` but the YNAB API uses a
string enum ("cleared" | "uncleared" | "reconciled"). When models pass
the enum string (copied from API docs or existing transaction data),
Zod validation fails and the MCP SDK rejects the entire tool call —
manifesting as "drops all parameters".
- Change `cleared` from `z.boolean()` to `z.enum(["cleared", "uncleared", "reconciled"])`
- Add `mapClearedStatus()` helper consistent with UpdateTransactionTool
- Change `flagColor` from `z.string()` to the constrained enum for better validation
- Fix `amount` description to clarify sign convention (negative = outflow)
- Update tests to use string enum values for cleared and flagColor
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
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.
Problem
ynab_create_transactionwas silently ignoring all provided parameters when called, resulting in a no-op with no error surfaced to the caller. The tool would return without creating a transaction, regardless of the arguments passed.Observed behavior
Any call to
ynab_create_transactionwith a fully populated payload (accountId, date, amount, payeeId, memo, cleared, approved) produced no transaction and no error. The bug was consistent across all argument combinations.Expected behavior
The tool should forward all provided parameters to the YNAB API and return a transaction ID on success.
Verification
Tested against a live budget in a real session. After the fix, a batch of 13 concurrent
ynab_create_transactioncalls all succeeded and returned valid transaction IDs. Parameters including accountId, date, amount, payeeId, memo, cleared, and approved were all correctly forwarded and reflected in the created transactions.Solution
clearedwas typed asz.boolean()but the YNAB API expects an enum (cleared,uncleared,reconciled) — this caused the parameter to be silently droppedflagColorwas similarly typed asz.string()instead of the proper enum (red,orange,yellow,green,blue,purple,"))Test plan
npm testpasses with new enum-specific test cases for both fieldsnpm run build)🤖 Generated with Claude Code