feat(mcp): shared query schema fragments for platform tools#7714
Open
andypalmi wants to merge 7 commits into
Open
feat(mcp): shared query schema fragments for platform tools#7714andypalmi wants to merge 7 commits into
andypalmi wants to merge 7 commits into
Conversation
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 Report✅ All modified and coverable lines are covered by tests. 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
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
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
8bfb22e to
9742987
Compare
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
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.
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 toolsearchQuery,sortParams,auditLogFilters- opt-in add-ons a tool spreads only when its route supports thempaginationParams(base + search + sort) andauditLogQuery(paginationParams + audit filters) - pre-composed for the frequent casesThe module lives at
forge/ee/lib/mcp/schemas.js, one level abovetools/, 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
mainonce this merges.Closes #7669