Skip to content

feat(mcp): shared query schema fragments for platform tools#7714

Open
andypalmi wants to merge 7 commits into
mainfrom
feat/mcp-tools-shared-schemas
Open

feat(mcp): shared query schema fragments for platform tools#7714
andypalmi wants to merge 7 commits into
mainfrom
feat/mcp-tools-shared-schemas

Conversation

@andypalmi

Copy link
Copy Markdown
Contributor

Description

Adds forge/ee/lib/mcp/schemas.js, a shared module of composable zod query fragments that the Story 5 read tools compose from instead of redefining pagination/search/sort/audit-log fields in each tool file:

  • basePagination (cursor, limit, page) - spread by every paginated list tool
  • searchQuery, sortParams, auditLogFilters - opt-in add-ons a tool spreads only when its route supports them
  • paginationParams (base + search + sort) and auditLogQuery (paginationParams + audit filters) - pre-composed for the frequent cases

The module lives at forge/ee/lib/mcp/schemas.js, one level above tools/, so the tool loader does not register it as a tool module.

This is the foundational piece the read-tool PRs build on; those PRs are branched from this branch and their bases will retarget to main once this merges.

Closes #7669

Adds forge/ee/lib/mcp/schemas.js with composable zod query fragments
(basePagination, searchQuery, sortParams, auditLogFilters, and the
pre-composed paginationParams and auditLogQuery) that the read tools
compose from. Lives outside tools/ so the tool loader does not register
it as a tool module.

Ref #7669
@codecov

codecov Bot commented Jul 4, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 75.41%. Comparing base (5abb3d8) to head (103f9ae).
⚠️ Report is 6 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #7714      +/-   ##
==========================================
+ Coverage   75.37%   75.41%   +0.03%     
==========================================
  Files         425      426       +1     
  Lines       22518    22551      +33     
  Branches     5945     5949       +4     
==========================================
+ Hits        16973    17006      +33     
  Misses       5545     5545              
Flag Coverage Δ
backend 75.41% <100.00%> (+0.03%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 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.

Adds appendQuery(url, args, keys) plus the per-fragment key lists
(basePaginationKeys, paginationParamsKeys, auditLogQueryKeys) so every
read tool serialises its supported query params one consistent,
URL-encoded, array-aware way instead of hand-rolling it per tool.

Ref #7669
@andypalmi andypalmi force-pushed the feat/mcp-tools-shared-schemas branch from 8bfb22e to 9742987 Compare July 6, 2026 13:13
Add canonical entity-id param fragments to the shared schemas module, and a toolFinder and recordingInject helper to the shared MCP test lib so the per-domain specs stop redefining them.
Split pagination into opt-in fragments so each tool advertises only the
query params its backing route's finder actually honors:

- basePagination is now cursor + limit only; page moves to a separate
  pageParam fragment (only Device and Project finders implement offset)
- limit defaults to 50 to bound how much one call returns to an agent
- sortParams drops the unused order alias (no finder reads it)
- auditLogFilters keeps event as a single-or-array union plus username
- remove the paginationParams and auditLogQuery combos; tools compose the
  fragments they need instead
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: No status

Development

Successfully merging this pull request may close these issues.

5.0 Shared schema fragments

1 participant