Query JSON File
jq_queryExtract fields from saved JSON files using jq-like filter expressions, enabling local data queries without new HTTP requests. Process large PageSpeed responses or any allowed local JSON.
Instructions
Query an existing JSON file with a jq-like filter expression.
This tool allows you to extract data from saved JSON files without making new HTTP requests. Useful for:
Extracting different fields from a large saved response
Applying multiple queries to the same data
Processing any local JSON file within allowed directories
Args:
filepath (string, required): Path to a JSON file to query
jq_filter (string, required): JSON path filter expression
max_result_size (number): Max bytes inline (default: 500KB, max: 1MB)
save_to_file (boolean): Force save result to file
output_dir (string): Custom directory to save result files
Filter Syntax:
.key - Get object property
.[n] - Get array element at index n (non-negative only, also .n with dot notation)
.[n:m] - Array slice from n to m
.["key"] - Bracket notation for keys with special chars
.name,.email - Multiple comma-separated paths (returns array of values, max 20)
Note: Negative indices not supported (unlike real jq)
Security:
Only files in these directories can be read:
Our temp directory (files saved by curl_execute)
MCP_CURL_OUTPUT_DIR environment variable path
Current working directory and ALL subdirectories (broad - ensure cwd is safe)
Maximum file size: 10MB
Examples:
Extract name: { "filepath": "/path/to/response.txt", "jq_filter": ".name" }
Multiple fields: { "filepath": "/path/to/data.json", "jq_filter": ".name,.email,.id" }
Array slice: { "filepath": "/path/to/list.json", "jq_filter": ".items[0:5]" }
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"filepath": "<filepath>",
"jq_filter": "<jq_filter>"
},
"name": "jq_query"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| filepath | Yes | Path to a JSON file to query. Must be in temp directory, MCP_CURL_OUTPUT_DIR, or current working directory. | |
| jq_filter | Yes | JSON path filter expression. Supports: .key, .[n] or .n (non-negative array index), .[n:m] (slice), .["key"] (bracket notation), .a,.b (multiple comma-separated paths return array, max 20). Negative indices not supported. | |
| output_dir | No | Directory to save result files (must exist and be writable) | |
| save_to_file | No | Force save result to file. Returns filepath instead of content | |
| max_result_size | No | Max bytes to return inline (default: 500KB, max: 1MB). Larger results auto-save to file |