atxtechbro / atxtechbro/dotfiles

feat(github-mcp-server): Improve default perPage parameter to prevent token limit errors

Open
#640 2 comments 0 reactions 0 assignees View on GitHub
developer-experience enhancement github-mcp-server
Dominant language
Shell
Stars
27
Forks
2
PR merge metrics
No merged PRs in 30d

Description

## Problem

When using GitHub MCP server tools like `list_pull_requests`, the default response size often exceeds the maximum allowed tokens (25,000), causing errors and requiring manual pagination/filtering.

### Example Error
```
● github:list_pull_requests (MCP)(owner: "atxtechbro", repo: "dotfiles", state: "closed", perPage: 10)
⎿ Error: MCP tool "list_pull_requests" response (58369 tokens) exceeds maximum allowed tokens (25000).
Please use pagination, filtering, or limit parameters to reduce the response size.
```

Even with `perPage: 10`, the response still exceeds token limits due to the detailed data returned for each PR.

## Proposed Solution

Since we control the github-mcp-server implementation, we should:

1. **Lower default `perPage` values** - Perhaps default to 5 or even 3 for list operations
2. **Add response size estimation** - Calculate approximate token usage based on typical PR/issue data
3. **Implement smart defaults** - Different defaults for different operations (e.g., list_pull_requests vs list_issues)
4. **Add a `compact` parameter** - Option to return minimal data (just title, number, state) for list operations

## Benefits

- Fewer failed API calls due to token limits
- Better developer experience without constant pagination adjustments
- More efficient token usage in AI conversations
- Reduced friction when browsing repository data

## Implementation Ideas

```python
# Example: Smart defaults based on operation
DEFAULT_PER_PAGE = {
'list_pull_requests': 3, # PRs have diffs, lots of data
'list_issues': 5, # Issues are typically smaller
'list_commits': 10, # Commits are compact
# etc.
}
```

This is a recurring pain point that wastes tokens and disrupts workflow. Let's make the defaults smarter!

Contributor guide

No contributing guide indexed for this repository

Research direction

The issue does not identify repository files, tests, or an implementation entry point. First locate the github-mcp-server code and the list operation handlers, then determine whether the project wants lower defaults, response estimation, operation-specific defaults, or a compact parameter; done should include tests showing list responses stay within the token limit.

Written by the indexing model from the issue text.

Assessment

Tech stack
github
Domain
api, tooling
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.