JSONPath Tool for MCPify

Surgically extract exactly what you need from massive JSON payloads. Reduce token usage by up to 99% with precise path-based data extraction.

99%
Token Reduction
Extract only needed fields instead of entire payloads
10x
Faster Processing
Smaller contexts mean quicker AI responses
100%
Accuracy
No hallucination from irrelevant data

How JSONPath Tool Works

Without JSONPath Tool

// Entire 37KB response sent to AI
{
  "users": [...500 users...],
  "metadata": {...},
  "analytics": {...},
  "debug": {...}
}
// AI must process everything
  • ❌ 37,000+ tokens consumed
  • ❌ Slow response times
  • ❌ Risk of hallucination from noise
  • ❌ Higher API costs

With JSONPath Tool

// JSONPath: $.users[0:5].email
// Returns only:
[
  "[email protected]",
  "[email protected]",
  "[email protected]",
  "[email protected]",
  "[email protected]"
]
  • ✅ Only 142 tokens used
  • ✅ Instant extraction
  • ✅ Clean, focused data
  • ✅ 99% cost reduction

Powerful JSONPath Features

Advanced Path Expressions

Support for wildcards, recursive descent, array slicing, and filtering predicates.

$.store.book[?(@.price < 10)]

Conditional Filtering

Extract data based on complex conditions with comparison and logical operators.

$.users[?(@.role=="admin")]

Array Operations

Slice arrays, access by index, and extract ranges with Python-like syntax.

$.results[0:10:2]

Type-Safe Extraction

Validated extraction with type checking and error handling built-in.

$.items[*].price.number()

Nested Navigation

Navigate deeply nested structures with recursive descent and wildcards.

$..author

Text Transformations

Apply string operations and transformations during extraction.

$.name.toLowerCase()

Real-World Examples

Extract Active User Emails

JSONPath Expression:

$.users[?(@.status=="active")].email

Get Top 5 Product Names by Price

JSONPath Expression:

$.products[?(@.price > 100)][0:5].name

Returns:

[
  "Premium Laptop",
  "Smart TV 65"",
  "Gaming Console",
  "Drone Pro",
  "Studio Headphones"
]

Extract Nested Address Fields

JSONPath Expression:

$.customers[*].addresses[?(@.type=="billing")].city

Returns:

[
  "New York",
  "San Francisco",
  "Chicago",
  "Austin"
]

Easy Integration with MCPify

MCP Tool Definition

{
  "tool": "json_get_by_path",
  "description": "Extract data from JSON using JSONPath expressions",
  "input_schema": {
    "type": "object",
    "properties": {
      "ref": {
        "type": "string",
        "description": "Reference to cached API response"
      },
      "path": {
        "type": "string",
        "description": "JSONPath expression (e.g., $.users[*].email)"
      },
      "default": {
        "description": "Default value if path not found",
        "nullable": true
      }
    },
    "required": ["ref", "path"]
  },
  "examples": [
    {
      "description": "Get all admin emails",
      "input": {
        "ref": "resp_123",
        "path": "$.users[?(@.role=='admin')].email"
      }
    }
  ]
}

Usage in AI Agent

// Step 1: Fetch API data (returns reference)
const response = await mcpify.call("crm.list_contacts", {
  limit: 1000
});

// Step 2: Extract only what you need
const emails = await mcpify.call("json_get_by_path", {
  ref: response.ref,
  path: "$.contacts[?(@.subscribed==true)].email"
});

// Step 3: AI processes minimal, focused data
await agent.process({
  task: "Send newsletter",
  recipients: emails // Only 50 emails vs 1000 full contacts
});

Start Extracting Smarter with JSONPath Tool

Reduce token usage by 99% and eliminate hallucination from irrelevant data. Available in every MCPify service.