Skip to main content
Glama

WritersLogic verifiable AI agents

union-branch

Which oneOf / anyOf branch a JSON value matches, or why several or none do — Evaluates a JSON value against every branch of a oneOf or anyOf in a caller-supplied JSON Schema 2020-12 (or OpenAPI schema converted to it) and reports which branches match, the exact errors of each branch that fails with the JSON pointer of each offending value, the closest branch, and which branch an OpenAPI discriminator points to. For agents debugging why a tool or API payload is rejected w

Tool call template

Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {
      "schema": "<schema>",
      "value": "<value>"
    },
    "name": "union-branch"
  }
}

Input Schema

NameRequiredDescriptionDefault
atNoJSON pointer to the subschema holding the union ("" for the root, "/properties/pet" for a nested one).
valueYesThe JSON value to classify.
schemaYesThe root schema; $ref targets are resolved inside it. Full JSON Schema 2020-12 (local $ref only).
keywordNoRequired only when the subschema has both.

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observed

TDQS

A4.1/5.0
Behavior4/5

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

With no annotations, the description carries the burden and does well: it enumerates the outputs (matching branches, per-branch errors with JSON pointers, closest branch, discriminator resolution) and notes support for OpenAPI schemas converted to 2020-12. It leaves implicit that the tool is read-only/non-mutating and says nothing about $ref scope beyond the schema field.

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?

Front-loaded with a one-line summary before the detail clause, which is good structure. The body is a dense run-on sentence that could be split for scanning, and the text appears truncated mid-word, slightly hurting readability.

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?

No output schema exists, so the description must explain return values and it does so thoroughly (matches, per-branch errors with pointers, closest branch, discriminator target). For a four-param analysis tool this is near complete, with only mutability/read-only confirmation missing.

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 coverage is 100%, so the schema already documents at/schema/value/keyword. The description adds some meaning (discriminator, OpenAPI conversion) but does not explain how `at` targets a nested union or when `keyword` is required beyond what the schema states. Baseline 3 is appropriate.

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

Purpose5/5

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

States a specific verb (evaluates) and resource (a JSON value against every branch of a oneOf/anyOf in a caller-supplied JSON Schema) up front, then the em-dash clause names the outputs. This clearly distinguishes it from validation-adjacent siblings like cross-field-rules or enum-canonicalize.

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

Usage Guidelines4/5

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

The trailing clause 'For agents debugging why a tool or API payload is rejected' gives a concrete usage context, and the framing of 'which branch matches, or why several or none do' implies the trigger. No explicit when-not or named alternative is offered, keeping it short of a 5.

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.

Resources