Skip to main content
Glama
GautamVhavle

Universal JSON Agent MCP

by GautamVhavle

sort_by

Sort an array of objects in a loaded JSON document by a chosen field and dot-notation path, with optional descending order, to order records for review.

Instructions

Sort an array of objects by a field.

Args: alias: The alias of the loaded document. path: Dot-notation path to the array of objects. field: The field to sort by (e.g. "price", "name"). descending: Sort in descending order (default False = ascending).

Returns: The sorted array.

Input Schema

NameRequiredDescriptionDefault
pathYes
aliasYes
fieldYes
descendingNo

Output Schema

NameRequiredDescriptionDefault
resultYes

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.1.0

TDQS

B3.3/5.0
Behavior2/5

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

With no annotations, the description carries the full behavioral burden. It says 'Returns: The sorted array,' implying a non-mutating transform, but never states whether the underlying loaded document is modified, how it handles missing fields or non-comparable types, or what errors can occur. For a mutation-adjacent data operation this is a meaningful gap.

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?

The one-line summary is front-loaded and each Args entry is short and useful; nothing is padding. The docstring scaffolding (Args:/Returns:) is slightly verbose but aids scanning rather than hurting it.

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

Completeness3/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-value detail is not strictly required, and the parameter docs are solid. What's missing is the behavioral context an agent would want before calling: whether the sort is in-place on the loaded document, and how failures (bad path, missing field) surface.

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

Parameters4/5

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

Schema description coverage is 0%, so the description must compensate, and it largely does: alias is tied to a loaded document, path is specified as dot-notation, field is given with examples ('price', 'name'), and descending is explained with its default and direction. Only edge cases like nested field paths within the array elements are left unclear.

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?

A specific verb and resource ('Sort an array of objects by a field'), plus the framing that alias refers to a loaded document, makes the operation immediately identifiable. It does not, however, explicitly distinguish itself from siblings like filter_objects or group_by, which operate on the same loaded arrays.

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?

Usage is only implied: 'alias of the loaded document' and 'dot-notation path to the array' signal the load-then-query workflow. There is no statement of when to prefer this over filter_objects, group_by, or min_max, and no exclusions or prerequisites given.

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