Skip to content

feat(mcp): bound tool string inputs and disclose side effects - #644

Merged
fclairamb merged 10 commits into
mainfrom
chore/mcp-tool-schema-quality
Oct 23, 2026
Merged

fclairamb merged 10 commits into
mainfrom
chore/mcp-tool-schema-quality

Conversation

@fclairamb

@fclairamb fclairamb commented Oct 22, 2026 •

Copy link
Copy Markdown
Owner

Implements specs/done/2026/10/2026-10-23-01-mcp-tool-schema-quality.md: MCP tool schemas that are bounded and say what they change. It came from an external Assay scan; its additionalProperties finding was already fixed on main.

What changed

  • Bounded string inputs. boundInputSchema (server/internal/mcp/tools.go) gives every input string maxLength 2048, and 64 KB for script and customCss. Required strings and identifier, uid, cursor get minLength 1. Optional free text gets none, so update_* can still clear a field with an empty string. Bounds apply to inputs only: output schemas are untouched. They are advertised in tools/list, not enforced (handler.go does not validate against inputSchema, same stance as additionalProperties).
  • Side effects disclosed on create_check, update_check, delete_check, create_status_page, update_status_page, delete_status_page: quota, reversibility, cascade, taken from the handlers.
  • Parameter interaction stated on list_checks, list_incidents (filters combine with AND), get_check, get_status_page (UID or slug), get_incident (UID only) and probe (kind selects the mode).
  • Shorter descriptions. Removed the restated output fields on 8 tools (list_results, delete_check, validate_check, run_check, diagnose_check, list_check_groups, list_status_pages, delete_status_page). The pagination hint stays.

No breaking change: tools/list shows new maxLength / minLength, and some descriptions are shorter.

Tests

tools_contract_test.go: every string input has maxLength, required ones minLength >= 1, optional free text stays clearable, long inputs keep their own bound, the six mutating tools mention "reversible" or "permanent", and a 5000-character value does not crash probe. make build-backend lint-back test passes.

Decided by autopilot

No open questions in this spec.

🤖 Generated with Claude Code

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@codecov

codecov Bot commented Oct 22, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 98.55072% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 83.70%. Comparing base (bd93ee7) to head (caf7eb3).

Files with missing lines Patch % Lines
server/internal/mcp/tools.go 95.83% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #644      +/-   ##
==========================================
- Coverage   83.71%   83.70%   -0.02%     
==========================================
  Files        1269     1269              
  Lines      129785   129812      +27     
==========================================
+ Hits       108645   108654       +9     
- Misses      21131    21149      +18     
  Partials        9        9              
Files with missing lines Coverage Δ
server/internal/mcp/tools_checks.go 88.12% <100.00%> (+0.09%) ⬆️
server/internal/mcp/tools_checktypes.go 94.57% <100.00%> (-0.05%) ⬇️
server/internal/mcp/tools_diagnose.go 73.61% <100.00%> (-0.37%) ⬇️
server/internal/mcp/tools_groups.go 87.09% <100.00%> (ø)
server/internal/mcp/tools_incidents.go 86.73% <100.00%> (+0.04%) ⬆️
server/internal/mcp/tools_jsauthoring.go 90.66% <100.00%> (+0.12%) ⬆️
server/internal/mcp/tools_merged.go 95.23% <100.00%> (+0.05%) ⬆️
server/internal/mcp/tools_results.go 97.68% <100.00%> (-0.03%) ⬇️
server/internal/mcp/tools_run_check.go 93.33% <100.00%> (-0.22%) ⬇️
server/internal/mcp/tools_statuspages.go 98.53% <100.00%> (+<0.01%) ⬆️
... and 1 more

... and 13 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

E2E shard 2 failed at setup with "failed to bind host port 0.0.0.0:55432:
address already in use" (run 39863144085), although the job had reserved
55432 with ip_local_reserved_ports. The reservation only covers ports
allocated after it runs, so a socket opened earlier in the job can still
hold it.

docker-compose.yml now takes the host port from SP_PG_HOST_PORT (default
55432, unchanged locally). The e2e-tests job sets it to 25432, below the
32768-60999 range, and drops the sysctl step.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
fclairamb and others added 4 commits October 23, 2026 08:13
Advertise maxLength on every input string (64 KB for js scripts and custom
CSS) and minLength 1 on required strings and identifiers. Mutating tools
state quota, reversibility and cascade; multi-param tools say how filters
combine; descriptions no longer restate outputSchema fields.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…nd disclose side effects

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…d disclose side effects

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@fclairamb fclairamb changed the title docs: MCP tool schema quality todo feat(mcp): bound tool string inputs and disclose side effects Oct 23, 2026
@fclairamb
fclairamb enabled auto-merge (squash) October 23, 2026 12:55
@fclairamb
fclairamb merged commit 22039c7 into main Oct 23, 2026
33 checks passed
@fclairamb
fclairamb deleted the chore/mcp-tool-schema-quality branch October 23, 2026 13:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant