googleapis / googleapis/mcp-toolbox
Add pagination
- Dominant language
- Go
- Stars
- 16.5k
- Forks
- 1.7k
- Avg merge
- 4d 9h
- Merged PRs (30d)
- 85
Description
### Prerequisites
- [x] Search the [current open issues](https://github.com/googleapis/genai-toolbox/issues)
### What are you trying to do that currently feels hard or impossible?
I'm experimenting with migration of a python MVP I created from scratch to genai-toolbox. One of the question users ask is "What equipment are experiencing high priority issues" which is an open set.
I want to return results sorted by some criteria and filtered using LIMIT/OFFSET which is no problem, but so that the LLM can identify that there are more rows (i.e. display to the user the top 10 problems in markdown then ask the user if they want to see the next 10 or drill down etc)
What I found worked well was to return a dictionary containing both data and additional context i.e. the number of rows returned, and a flag if there are more (i.e. number rows is same as LIMIT)
### Suggested Solution(s)
Allow response to be shaped something like
```json
{
"rows": [...],
"pagination": {
"limit": 100,
"offset": 0,
"returned_count": 100,
"has_more": true,
"next_offset": 100,
"total_count": 347 // Optional, expensive to calculate
}
}
```
### Alternatives Considered
_No response_
### Additional Details
_No response_
Contributor guide
Research direction
Start by tracing how database tool results are shaped and how LIMIT/OFFSET values are handled in the MCP server. Define the response contract for rows and pagination metadata, including whether total_count is supported, then verify that callers can identify additional pages and request the next offset.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- go
- Domain
- api, backend-api-design, databases
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100