optimize_json
Reduce token usage by optimizing JSON payloads: extract specific fields via JSONPath, limit output size, and flatten deep nesting.
Instructions
Optimize any JSON payload to reduce token usage.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| data | Yes | Raw JSON string to optimize, OR a file path to a JSON file. When an MCP tool response is too large and gets saved to a file, pass the file path here (e.g. '/path/to/tool-results/file.txt'). | |
| jsonpath | No | JSONPath expression to extract specific fields (e.g. '$[*].name', '$[?@.state=="open"]') | |
| max_chars | No | Maximum characters in output | |
| max_depth | No | Max nesting depth before flattening (default 5) |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |