> ## Documentation Index
> Fetch the complete documentation index at: https://docs.hasmcp.com/llms.txt
> Use this file to discover all available pages before exploring further.

# How can I use JMESPath to filter out irrelevant fields from an API response?

> Dropping massive pagination logs and visual metadata using exact JSON matrix mapping safely.

# Filtering Irrelevant Fields with JMESPath

When an MCP action runs successfully, external APIs invariably return metadata exclusively intended for graphical user interfaces (GUIs), such as pagination coordinates (`next_page_cursor`), styling data (`font_color`), or HTML attributes.

You can strip this structural noise instantly using JMESPath projection.

### Example: Stripping Root Metadata

**The Raw Upstream API Response:**

```json theme={null}
{
 "_metadata": {
 "latency_ms": 142,
 "has_more": false,
 "theme": "dark"
 },
 "customers": [
 { "id": 1, "name": "Google", "status": "active" },
 { "id": 2, "name": "Apple", "status": "pending" }
 ]
}
```

Instead of sending those useless `_metadata` tokens to Claude or OpenAI through HasMCP, simply provide the following JMESPath execution string in the Provider Tool settings:

**The JMESPath Input:**
`customers`

**The Final Pruned Output Delivered to the LLM:**

```json theme={null}
[
 { "id": 1, "name": "Google", "status": "active" },
 { "id": 2, "name": "Apple", "status": "pending" }
]
```

By simply addressing the root object `customers`, the engine immediately discards everything surrounding it automatically.
