JSON Navigation Tools

MCPify provides specialized tools for navigating, extracting, and transforming JSON data. Keep AI context tight by extracting exactly what's needed.

Tool Categories

Query & Search
Filter & Extract
Transform & Reshape
Slice & Chunk
Validate & Schema
Navigate & Traverse

Core JSON Tools

json_get_by_path

Extract data using JSONPath expressions. Supports wildcards, filters, and recursive descent.

Parameters

  • ref - Response reference ID
  • path - JSONPath expression (e.g., $.users[*].email)
  • default - Optional default if path not found

Example

{
  "tool": "json_get_by_path",
  "args": {
    "ref": "resp_123",
    "path": "$.orders[?(@.status=='pending')].id"
  }
}
// Returns: [101, 105, 112]

field_extract

Extract specific fields from JSON objects or arrays. Supports nested paths and renaming.

Parameters

  • ref - Response reference ID
  • fields - Array of field paths to extract
  • rename - Optional field renaming map

Example

{
  "tool": "field_extract",
  "args": {
    "ref": "resp_123",
    "fields": ["id", "name", "company.name"],
    "rename": {"company.name": "company"}
  }
}
// Input: Complex user objects
// Output: [{id, name, company}, ...]

array_slice

Extract a slice of an array with Python-like syntax. Supports negative indices and steps.

Parameters

  • ref - Response reference ID
  • path - Path to array
  • start - Start index (inclusive)
  • end - End index (exclusive)
  • step - Step size (default: 1)

Example

{
  "tool": "array_slice",
  "args": {
    "ref": "resp_123",
    "path": "$.results",
    "start": 0,
    "end": 10,
    "step": 2
  }
}
// Returns every 2nd item from first 10

Complete Tool Reference

ToolPurposeKey Features
Query & Search Tools
json_get_by_pathExtract via JSONPathWildcards, filters, recursive
json_searchSearch for valuesFuzzy matching, regex
json_list_fieldsList all field namesNested paths, types
Filter & Extract Tools
field_extractExtract specific fieldsWhitelist, rename
json_filter_arrayFilter array itemsPredicates, conditions
json_exclude_fieldsRemove fieldsBlacklist, patterns
Transform & Reshape Tools
json_flattenFlatten nested structureDot notation keys
json_unflattenRestore nested structureFrom dot notation
json_map_valuesTransform valuesFunctions, mappings
Slice & Chunk Tools
array_sliceExtract array sliceStart, end, step
response_chunkSplit into chunksSize, overlap
json_paginateCreate pagesPage size, offset
Validate & Schema Tools
json_validateValidate against schemaJSON Schema support
json_get_schemaInfer schemaFrom sample data
json_diffCompare JSONsDeep diff, patches
Navigate & Traverse Tools
json_traverseWalk JSON treeVisitors, callbacks
json_get_parentGet parent nodeFrom path
json_get_siblingsGet sibling nodesSame level

Common Usage Patterns

Progressive Data Extraction

// 1. Fetch API response (gets reference, not data)
const response = await mcpify.call("api.fetch", params);

// 2. Inspect structure
const fields = await mcpify.call("json_list_fields", {
  ref: response.ref
});

// 3. Extract only needed fields
const data = await mcpify.call("field_extract", {
  ref: response.ref,
  fields: ["id", "status", "items[*].name"]
});

// 4. Filter if needed
const filtered = await mcpify.call("json_filter_array", {
  ref: response.ref,
  path: "$.items",
  condition: "status == 'active'"
});

Error Field Extraction

// Extract specific error details without full payload
const errorCode = await mcpify.call("json_get_by_path", {
  ref: error_ref,
  path: "$.error.code"
});

const hint = await mcpify.call("json_get_by_path", {
  ref: error_ref,
  path: "$.error.hint",
  default: "Check parameters and retry"
});

Chunked Processing

// Process large dataset in chunks
const chunks = await mcpify.call("response_chunk", {
  ref: large_response.ref,
  chunk_size: 100,
  overlap: 10
});

for (const chunk of chunks) {
  const processed = await processChunk(chunk);
  results.push(processed);
}

Performance Best Practices

DO

  • ✓ Use specific JSONPath expressions
  • ✓ Extract only needed fields
  • ✓ Chain tools for complex operations
  • ✓ Use field_extract for multiple fields
  • ✓ Cache intermediate results
  • ✓ Process in chunks for large data

AVOID

  • ✗ Loading entire payloads unnecessarily
  • ✗ Multiple calls for related fields
  • ✗ Complex JSONPath in tight loops
  • ✗ Recursive descent on large data
  • ✗ Extracting then filtering (filter first)
  • ✗ Processing without chunking

Related Resources