Skip to main content
Glama

IA-QA — 152 QA & Dev Tools for AI Agents

transform_json_array

Read-onlyIdempotent

Transform a JSON array using common operations: pluck (extract specific fields), filter (by field value), sort_by (field), group_by (field), count_by (field), uniq_by (field). Useful for processing MCP tool results and LLM structured outputs.

Input Schema

NameRequiredDescriptionDefault
nNoFor first_n / last_n: number of items
pathNoOptional dot-notation path to the array within the JSON object (e.g. "data.items")
fieldNoField to operate on (for sort_by, group_by, count_by, uniq_by, filter)
inputYesThe JSON containing an array (or an object with an array at `path`) — a JSON string, or the value itself.
fieldsNoComma-separated field list for "pluck" (e.g. "id,name,email")
filter_opNoFor "filter": "==" | "!=" | ">" | ">=" | "<" | "<=" | "contains" | "exists" | "!exists"
operationYesOperation: "pluck", "filter", "sort_by", "group_by", "count_by", "uniq_by", "reverse", "first_n", "last_n", "flatten"
sort_orderNoFor sort_by: "asc" (default) or "desc"
filter_valueNoFor "filter": value to compare against

Output Schema

NameRequiredDescriptionDefault
countNo
fieldNo
orderNo
totalNo
fieldsNo
resultNo
removedNo
operationNo
group_countNo
unique_valuesNo
removed_duplicatesNo

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed1 schema field changed
    • addedInput schema / examples
      Added value: +[
      +  {
      +    "field": "v",
      +    "input": [
      +      {
      +        "v": 2
      +      },
      +      {
      +        "v": 10
      +      },
      +      {
      +        "v": 1
      +      }
      +    ],
      +    "operation": "sort_by",
      +    "sort_order": "desc"
      +  }
      +]
  2. Changed2 schema fields changed
    • changedInput schema / properties / input / description
      Previous value: -"JSON string containing an array (or object with an array at path)"New value: +"The JSON containing an array (or an object with an array at `path`) — a JSON string, or the value itself."
    • changedInput schema / properties / input / type
      Previous value: -"string"New value: +[
      +  "string",
      +  "object",
      +  "array"
      +]
  3. Changed1 schema field changed
    • addedOutput schema / properties
      Added value: +{
      +  "count": {
      +    "type": "number"
      +  },
      +  "field": {},
      +  "fields": {},
      +  "group_count": {
      +    "type": "number"
      +  },
      +  "operation": {
      +    "type": "string"
      +  },
      +  "order": {},
      +  "removed": {
      +    "type": "number"
      +  },
      +  "removed_duplicates": {
      +    "type": "number"
      +  },
      +  "result": {},
      +  "total": {
      +    "type": "number"
      +  },
      +  "unique_values": {
      +    "type": "number"
      +  }
      +}
  4. Changed1 schema field changed
    • changedOutput schema / (root)
      Previous value: -nullNew value: +{
      +  "additionalProperties": true,
      +  "type": "object"
      +}
  5. First observed

TDQS

A3.5/5.0
Behavior3/5

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

Annotations already declare readOnlyHint, idempotentHint, destructiveHint=false and a closed-world scope, so the safety profile is fully covered structurally. The description adds only the post-processing use case and nothing about error behavior, invalid path handling, or how non-array input is treated — modest added value above annotations.

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

Conciseness4/5

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

Two front-loaded sentences with no filler; the operation enumeration is the most useful part and comes first. The parenthetical glosses per operation are economical, though the list is incomplete.

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

Completeness4/5

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

An output schema exists, so return values need not be explained, and all 9 parameters are schema-documented. Given the tool's moderate complexity, the description plus structured fields are nearly sufficient; the gap is the missing mention of reverse/first_n/last_n/flatten and any guidance on the optional path parameter.

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

Parameters3/5

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

Schema description coverage is 100% and each parameter is documented with enum-like value lists, so the schema carries the semantic load. The description's operation list partially duplicates the schema and is actually incomplete relative to it, adding no syntax or interaction detail (e.g. how field pairs with filter_op).

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

Purpose4/5

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

States a specific verb (Transform) and resource (JSON array) and enumerates the six primary operations, distinguishing it from simple converters like json_to_yaml or flatten_json. However, it omits four operations present in the schema (reverse, first_n, last_n, flatten), so the stated scope understates the tool.

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

Usage Guidelines3/5

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

"Useful for processing MCP tool results and LLM structured outputs" implies a usage context but names no alternatives and no exclusions. Sibling tools such as flatten_json, extract_json_path, and sort_lines overlap enough that an agent would benefit from explicit routing guidance that is absent here.

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

Try in Browser

Glama MCP Gateway

Add one secure layer between your agents and this server.