fix(legal-intakes): remove invalid bracket-operator schema property keys (Claude Cowork 400 fix)#80
Merged
adith-dinesh merged 2 commits intoMay 15, 2026
Conversation
The get_legal_intakes inputSchema had 6 property keys containing '[', ']',
and '$' characters which violate Anthropic/Vertex AI Claude's required pattern
^[a-zA-Z0-9_.-]{1,64}$:
filter__priority[$eq], filter__priority[$in], filter__priority[$ne]
filter__status[$eq], filter__status[$in], filter__status[$ne]
This caused a 400 BadRequestError from Claude Cowork / Claude Sonnet on
Vertex AI (EU), aborting the entire tool-calling session before any tool
was invoked.
Fix:
- Remove $eq variants (covered by the plain filter__priority / filter__status keys)
- Rename $in -> _in (filter__priority_in, filter__status_in)
- Rename $ne -> _ne (filter__priority_ne, filter__status_ne)
- Update handler to map the new safe names back to the API's expected
query-param format (filter__priority[$in], filter__status[$ne] etc.)
All property keys now match ^[a-zA-Z0-9_.-]{1,64}$.
tsc --noEmit: clean
Co-authored-by: Adith Dinesh <adith@spotdraft.com>
…md against invalid chars - Rewrite test/get-legal-intakes.test.mjs to match the renamed schema properties from PR #80 (filter__priority_in/ne, filter__status_in/ne) - Add a schema key validation test asserting every property key matches ^[a-zA-Z0-9_.-]{1,64}$, the pattern Anthropic Claude enforces before accepting any MCP connection - Add tests verifying handler mapping: filter__status_in -> filter__status[$in], filter__priority_in -> filter__priority[$in], and the *_ne variants -> [$ne] in the upstream query params - Remove tests referencing the deleted bracket keys (filter__status[$eq], filter__priority[$eq], etc.) - Update AGENTS.md at root, src/tools/, and src/tools/legal-intake/ with the invariant: all inputSchema.properties keys must match the valid pattern; never use [ ] $ in schema key names - map them inside the handler instead All 63 tests pass (npm test). Co-authored-by: Jaskaran Bhatia <jaskaran@spotdraft.com>
Contributor
Author
Follow-up commit: tests + AGENTS.md guardrails (1f34810)What was added on top of the schema-sanitization fix: Tests (
|
| New test | What it checks |
|---|---|
| Schema key pattern guard | Every inputSchema.properties key matches ^[a-zA-Z0-9_.-]{1,64}$ (the Anthropic validator pattern) |
| No legacy bracket keys | filter__status[$in], filter__status[$eq], etc. are gone from the schema |
filter__status_in → filter__status[$in] |
Handler maps safe name to API query-param correctly |
filter__priority_in → filter__priority[$in] |
Same for priority |
filter__status_ne → filter__status[$ne] |
ne variant maps correctly |
filter__priority_ne → filter__priority[$ne] |
Same for priority |
| Legacy string passthrough | String values for _in fields still work |
| Array rejection on non-$in field | Passing an array to filter__status_ne throws ValidationError |
AGENTS.md updates (3 files)
AGENTS.md(root): repo-wide guardrail — all tool schema keys must match^[a-zA-Z0-9_.-]{1,64}$src/tools/AGENTS.md: same rule at the tool-registry levelsrc/tools/legal-intake/AGENTS.md: detailed naming invariant + the safe-name→API-param mapping pattern
|
Your organization's Advanced Security usage limit has been reached. To continue using Advanced Security reviews, please upgrade your plan or increase your usage limits in your account settings. |
aditya-gupta-sde
approved these changes
May 15, 2026
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.
User description
Problem
Connecting the SpotDraft MCP (EU, OAuth) to Claude Cowork fails immediately with:
The
get_legal_intakestool'sinputSchema.propertiescontains 6 keys with bracket and dollar-sign characters that Anthropic's validator rejects:filter__priority[$eq],filter__priority[$in],filter__priority[$ne]filter__status[$eq],filter__status[$in],filter__status[$ne]Claude validates the entire tool list before accepting any request, so one bad property key blocks every conversation for any user with the MCP connector enabled.
Fix
filter__priority[$eq]filter__priorityfilter__priority[$in]filter__priority_infilter__priority[$ne]filter__priority_nefilter__status[$eq]filter__statusfilter__status[$in]filter__status_infilter__status[$ne]filter__status_neThe handler is updated to map the new safe parameter names back to the SpotDraft API's expected
filter__*[$in]/filter__*[$ne]query-param format internally — no API behaviour change.Validation
tsc --noEmit✅ cleanRelated
Generated description
Below is a concise technical summary of the changes proposed in this PR:
Enforce
getLegalIntakesschema properties to match Claude’s allowed key pattern and explain the invariant across the legal-intake AGENTS guidance so every MCP connector can pass validation. Map the safefilter__*inputs back to the SpotDraft query-param operators insidegetLegalIntakeswhile keeping legacy behavior and cover both schema invariants and handler mappings with focused tests.getLegalIntakesschema properties follow Claude’s allowed key pattern and update the AGENTS guidance plus schema tests to ban bracketed$names so every tool validates with strict MCP clients.Modified files (4)
Latest Contributors(2)
filter__*[$in]/[$ne]query params insidegetLegalIntakesand add handler tests that verify the mapping, legacy string support, and exact-match rejecting arrays where inappropriate.Modified files (2)
Latest Contributors(2)