Skip to content

feat(crashlytics): thread pageToken through get_report - #11048

Open
alexander-smityuk wants to merge 2 commits into
firebase:mainfrom
alexander-smityuk:crashlytics-report-page-token
Open

feat(crashlytics): thread pageToken through get_report#11048
alexander-smityuk wants to merge 2 commits into
firebase:mainfrom
alexander-smityuk:crashlytics-report-page-token

Conversation

@alexander-smityuk

Copy link
Copy Markdown

Description

The Crashlytics reports API returns a nextPageToken when a report has more groups than pageSize, and Report already declares nextPageToken?: string. But getReport had no parameter for sending a token back, so the crashlytics get_report MCP tool could only ever observe the first page — an agent that saw nextPageToken in the output had no way to act on it.

This threads a page token through the existing call path:

  • getReport takes an optional pageToken and, when set, sends it as the page_token query parameter alongside page_size.
  • ReportInputSchema gains an optional pageToken, described so an agent knows to source it from a previous response's nextPageToken and to keep filter and pageSize stable across the calls.
  • The get_report tool passes it through and its description now tells agents what to do when nextPageToken is present.

No behavior changes when no token is supplied: page_token is simply not sent. The parameter is optional and trailing, so existing getReport callers are unaffected.

Scenarios Tested

The src/crashlytics (100 tests) and src/mcp (169 tests) suites pass locally. Two unit tests were added to src/crashlytics/reports.spec.ts:

  • page_token is sent with the given value when a pageToken is passed.
  • page_token is absent otherwise — the nock interceptor uses an exact query match, so an unexpected page_token would fail to match and nock.isDone() would be false.

Also verified tsc --noEmit is clean and eslint/prettier report no new errors on the changed files.

Sample Commands

No CLI command or flag changes. Via the MCP tool, paging now looks like:

// first call
{ "appId": "1:1234567890:android:abc", "report": "TOP_VERSIONS", "filter": {}, "pageSize": 10 }
// response includes nextPageToken: "abc123"

// next page — same filter and pageSize, plus the token
{ "appId": "1:1234567890:android:abc", "report": "TOP_VERSIONS", "filter": {}, "pageSize": 10, "pageToken": "abc123" }

The Crashlytics reports API returns a `nextPageToken` when more groups
are available, but `getReport` had no way to send it back, so the
`get_report` MCP tool could only ever see the first page of results.

Add an optional `pageToken` to `ReportInputSchema` and to `getReport`,
forward it as the `page_token` query parameter when set, and pass it
through from the MCP tool. The tool description now tells agents to
call again with `pageToken` when a `nextPageToken` is present.

Behavior is unchanged when no `pageToken` is given: no `page_token`
parameter is sent.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request adds support for pageToken in the Crashlytics get_report MCP tool, allowing agents to page through report groups using the nextPageToken from previous responses. The changes include updating the input schema, updating the API call parameters to include page_token when provided, updating the tool description, and adding corresponding unit tests. I have no feedback to provide.

@alexander-smityuk

Copy link
Copy Markdown
Author

@joehan Hi, this is a small addition to the Crashlytics get_report MCP tool. Happy to adjust if you'd prefer a different shape.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants