data_query
Extract specific data, filter content, or restructure JSON, YAML, and TOML files using yq expressions, without modifying the original file.
Instructions
Extract specific data, filter content, or transform structure without modification.
Use when you need to extract specific data, filter content, or transform the structure of a JSON, YAML, or TOML file without modifying it.
Output contract: Returns {"success": bool, "result": Any, "format": str, "file": str, ...}. Side effects: None (read-only). Failure modes: FileNotFoundError if file missing. ToolError if format disabled or query fails.
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": {
"file_path": "<file_path>",
"expression": "<expression>"
},
"name": "data_query"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| cursor | No | Pagination cursor from previous response (omit for first page) | |
| file_path | Yes | Path to file | |
| expression | Yes | yq expression to evaluate (e.g., '.name', '.items[]', '.data.users') | |
| output_format | No | Output format (defaults to same as input file format) | |
| document_index | No | Optional YAML document index for multi-document files (0-based) |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| file | No | ||
| format | No | ||
| result | No | ||
| success | Yes | ||
| advisory | No | ||
| paginated | No | ||
| nextCursor | No | ||
| schema_info | No | ||
| structure_summary | No |