[mcp] Add escalations_get tool with pagination defaults#351
Closed
rahul-roy-glean wants to merge 1 commit into
Closed
[mcp] Add escalations_get tool with pagination defaults#351rahul-roy-glean wants to merge 1 commit into
rahul-roy-glean wants to merge 1 commit into
Conversation
Adds a new escalations_get MCP tool that addresses the 21MB response
problem when the tool is called with empty params ({}).
Key changes:
- New tool: escalations_get with limit (default 50, max 100) and offset
parameters, preventing unbounded fetches
- All params are optional; empty {} now defaults to limit=50 instead
of returning everything
- Query parameter for filtering escalations by text search
- Response formatting with truncated descriptions and pagination hints
- MSW mock handler in mcp-test-utils for the /rest/api/v1/escalations
endpoint
- Unit tests covering schema validation, API integration, response
formatting, and pagination
- Integration tests in server.test.ts for end-to-end tool execution
Co-authored-by: Rahul Roy <rahul-roy-glean@users.noreply.github.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.
Description
Adds a new
escalations_getMCP tool with built-in pagination (limit/offset) and a defaultlimitof 50 to prevent unbounded response sizes.Related Issue
Slack report:
escalations_getis called with empty params{}, returning a 21MB response body. This PR adds the tool with safe defaults so empty params return a bounded result set.Motivation and Context
The
escalations_gettool existed on the remote Glean MCP server but was missing from the local MCP server. When called with{}, the remote version returns every escalation (~21MB). This change:limit=50(max 100), so empty{}calls return a bounded resultoffsetfor pagination, allowing callers to page through results when neededThis is the "smallest safe change" approach: default limit first, explicit pagination via offset as an escape hatch.
Type of Change
How Has This Been Tested?
Tests added:
src/test/tools/escalations.test.ts— 15 tests covering schema validation (JSON schema snapshot, empty params, query, limit/offset, rejection of invalid values), API integration (default pagination, query filtering, offset pagination), and response formatting (empty results, null, normal results, pagination hints, description truncation)server.test.ts— 3 integration tests for end-to-end tool execution viacallToolHandler(default pagination, query filter, pagination withhasMoreResults)mcp-test-utilsforPOST /rest/api/v1/escalationsChecklist
Additional Notes
No existing flows are broken —
escalations_getis a net-new tool in the local MCP server. The remote MCP server's equivalent tool is unaffected since this change only touches the local server.Files changed:
packages/local-mcp-server/src/tools/escalations.ts— New tool implementation (schema, API call via raw fetch, response formatter)packages/local-mcp-server/src/server.ts— Register tool inTOOL_NAMES,listToolsHandler, andcallToolHandlerpackages/mcp-test-utils/src/mocks/handlers.ts— MSW mock for the escalations endpointpackages/local-mcp-server/src/test/tools/escalations.test.ts— Unit testspackages/local-mcp-server/src/test/server.test.ts— Integration testsSlack Thread