Skip to main content
Glama

response_filter

Read-onlyIdempotent

Filter, search, and paginate through large arrays in saved JSON response files to quickly locate specific items without reading the entire file.

Instructions

response_filter

Filters, searches, and paginates through arrays in saved JSON response files.

When to use

Use this tool when:

  • You need to find specific items in a large array (e.g. "find bitcoin in 18090 items")

  • You want to filter an array by a condition (e.g. "status = active", "price > 100")

  • You need to paginate through a large array page by page

  • The response is too large to inspect manually with response_slice

When NOT to use

  • Do NOT use bash, cat, head, tail, file, open, less, more, or any external command to read fileRef.path.

  • Do NOT read the file manually. This tool is the only allowed way to filter and paginate saved response files.

Parameters

  • path (required): The absolute file path from fileRef.path returned by invoke.

  • jsonPath (required): Path to the array to filter (e.g. pets, data.items, results). Leave empty for root-level arrays. Uses gjson syntax — recursive descent (..) is not supported; use exact paths like symbols.0.symbol or use search/filter instead.

  • search (optional): Full-text search across all fields of each item. Case-insensitive substring match (e.g. "bitcoin").

  • filter (optional): Structured filter condition. Format: field operator value. Supported operators: =, !=, contains, >, <, >=, <=. Examples: status = active, price > 100, name contains bitcoin.

  • page (optional): Page number starting from 1. Default is 1.

  • pageSize (optional): Items per page (max 50). Default is 10.

Returns

  • page: Current page number.

  • pageSize: Items per page.

  • total: Total number of matching items.

  • totalPages: Total number of pages.

  • items: Array of matching items for the current page.

  • strategy: Whether the file was processed in memory (memory) or streamed (streaming).

Examples

response_filter({
  "path": "/.../responses/...json",
  "jsonPath": "pets",
  "search": "fluffy",
  "page": 1,
  "pageSize": 5
})
response_filter({
  "path": "/.../responses/...json",
  "jsonPath": "data.items",
  "filter": "price > 50",
  "page": 2,
  "pageSize": 20
})

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
pageNooptional,Page number starting from 1 (default 1)
pathYesrequired,Absolute path returned in fileRef.path
filterNooptional,Structured filter condition (e.g. status = active, price > 100)
searchNooptional,Full-text search across all fields of each item
jsonPathNooptional,Path to the array to filter (e.g. pets, data.items). Leave empty for root arrays.
pageSizeNooptional,Items per page (max 50, default 10)
Behavior5/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

Annotations already mark readOnlyHint and idempotentHint, and the description adds substantial behavioral context: processing strategy (memory vs streaming), return fields, filter operator syntax, gjson path limitations (recursive descent not supported), and case-insensitive substring search. No contradictions with annotations.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is well-structured with clear headers (When to use, When NOT to use, Parameters, Returns, Examples) and a front-loaded one-sentence summary. The length is justified by the tool's complexity, and every sentence adds value—no fluff or redundancy.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness5/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Despite no output schema, the description includes a full 'Returns' section explaining each field (page, pageSize, total, totalPages, items, strategy). It also covers gjson syntax caveats, filter operators, and warnings about not reading files manually, making the description complete for a tool of this complexity.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters5/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Although schema coverage is 100%, the description enriches every parameter: it documents defaults (page=1, pageSize=10), max pageSize (50), gjson syntax examples, supported filter operators, and clarifies that jsonPath can be empty for root arrays. This goes well beyond the schema.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description opens with a specific verb+resource: 'Filters, searches, and paginates through arrays in saved JSON response files.' This clearly distinguishes it from siblings like response_slice, response_outline, and response_compress by covering three distinct operations on saved response arrays.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines5/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

Provides an explicit 'When to use' list (find specific items, filter by condition, paginate, response too large for response_slice) and a 'When NOT to use' section that forbids alternative tools like bash/cat/head. It even names response_slice as the alternative for manual inspection, giving clear usage context.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/mmadfox/swag2mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server