MCP Pagination CLI
CLI commands for paginating MCP tools, resources, and prompts
MCP Pagination CLI
Command-line interface for paginating through MCP server tools, resources, and prompts.
Commands Overview
| Command | Description |
|---|---|
praisonai mcp list-tools | List tools with pagination |
praisonai mcp list-resources | List resources with pagination |
praisonai mcp list-prompts | List prompts with pagination |
List Tools with Pagination
Basic Usage
# List first page of tools (default 50)
praisonai mcp list-tools
# Output:
# Available MCP Tools (50 of 75):
# • praisonai.workflow.run
# Execute a PraisonAI workflow
# ...
# More results available. Use --cursor NTAOptions
| Option | Description | Default |
|---|---|---|
--limit <n> | Maximum tools per page | 50 |
--cursor <cursor> | Pagination cursor from previous response | None |
--json | Output in JSON format | False |
Pagination with Cursor
# Get first page with limit
praisonai mcp list-tools --limit 10
# Use cursor from previous response to get next page
praisonai mcp list-tools --cursor NTA --limit 10JSON Output
# Get JSON output for programmatic use
praisonai mcp list-tools --json --limit 5Output:
{
"tools": [
{
"name": "praisonai.workflow.run",
"description": "Execute a PraisonAI workflow",
"inputSchema": {"type": "object"},
"annotations": {
"readOnlyHint": false,
"destructiveHint": true
}
}
],
"nextCursor": "NQ"
}Iterate Through All Pages
#!/bin/bash
# Script to iterate through all tool pages
cursor=""
page=1
while true; do
echo "=== Page $page ==="
if [ -z "$cursor" ]; then
result=$(praisonai mcp list-tools --json --limit 10)
else
result=$(praisonai mcp list-tools --json --limit 10 --cursor "$cursor")
fi
echo "$result" | jq '.tools[].name'
cursor=$(echo "$result" | jq -r '.nextCursor // empty')
if [ -z "$cursor" ]; then
echo "No more pages"
break
fi
page=$((page + 1))
doneList Resources with Pagination
# List resources
praisonai mcp list-resources
# With pagination
praisonai mcp list-resources --limit 20
# JSON output
praisonai mcp list-resources --jsonList Prompts with Pagination
# List prompts
praisonai mcp list-prompts
# With pagination
praisonai mcp list-prompts --limit 20
# JSON output
praisonai mcp list-prompts --jsonExit Codes
| Code | Meaning |
|---|---|
| 0 | Success |
| 1 | Error (invalid cursor, etc.) |
Error Handling
Invalid Cursor
praisonai mcp list-tools --cursor "invalid!!!"
# Error: Invalid cursor: ...
# Exit code: 1Out of Range Cursor
praisonai mcp list-tools --cursor "MTAwMA" # Offset 1000 when only 50 tools
# Error: Invalid cursor: offset 1000 out of range
# Exit code: 1Examples
Quick Tool Count
# Get total tool count
praisonai mcp list-tools --json --limit 1 | jq '.tools | length'Export All Tools to File
# Export all tools to JSON file
praisonai mcp list-tools --json > tools.jsonFilter by Annotation in Shell
# List only read-only tools (using jq)
praisonai mcp list-tools --json | \
jq '.tools[] | select(.annotations.readOnlyHint == true) | .name'Combine with Tools Search
# For more advanced filtering, use tools search
praisonai mcp tools search --read-only --jsonSee Also
- MCP Pagination Module – Code-based pagination usage
- MCP Tool Search CLI – Search and filter tools via CLI
- MCP CLI Overview – All MCP CLI commands