Skip to main content
Glama

append_to_array

Append a value to a JSON, YAML, or TOML array or Python module-level list, preserving inline or multiline layout, comments, and trailing commas.

Instructions

Append a value to a JSON, YAML or TOML array or a Python module-level list. The value follows the array's layout: an inline array stays inline ([1, 2] becomes [1, 2, 3]), one element per line gets a new line, and a trailing comma is kept. Comments are not elements: the comma goes before them.

Use this when: adding a list item. Don't use this when: adding a key-value pair (add_key).

Example: target="project.dependencies" value='"new-package"'

Input Schema

NameRequiredDescriptionDefault
valueYesValue as source text in the file's syntax, strings quoted (e.g. '"2.0.0"' or '42').
targetYesKey path from the top level to a JSON, YAML or TOML array ('project.dependencies'), or a Python module-level list's name.
file_pathYesAbsolute path to the source or config file.

Output Schema

NameRequiredDescriptionDefault
resultYes

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed3 schema fields changedv3.2.0
    • addedInput schema / properties / file_path / description
      Added value: +"Absolute path to the source or config file."
    • addedInput schema / properties / target / description
      Added value: +"Key path from the top level to a JSON, YAML or TOML array ('project.dependencies'), or a Python module-level list's name."
    • addedInput schema / properties / value / description
      Added value: +"Value as source text in the file's syntax, strings quoted (e.g. '\"2.0.0\"' or '42')."
  2. First observedv2.0.1

TDQS

A4.4/5.0
Behavior4/5

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

Annotations only declare the safety profile (readOnly=false, destructive=false, openWorld=false); the description adds genuinely non-obvious behavior — layout-preserving formatting, comma placement before comments, trailing-comma retention. It stops short of stating what happens when the target is missing or not an array, which matters for an in-place mutation.

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 purpose, then formatting rules, then usage gates, then a compact example — no filler. The formatting paragraph is slightly dense but every clause conveys distinct behavior.

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

Completeness5/5

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

With annotations covering safety, an output schema covering return values, and full parameter documentation in the schema, the description supplies the remaining caller-critical knowledge: supported formats, formatting preservation, and the sibling to use instead. Nothing needed to invoke it correctly is missing.

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 coverage is 100%, so the schema baseline already applies. The description still adds value by showing the concrete call shape (target="project.dependencies", value='"new-package"'), reinforcing that value is raw source text in the file's syntax rather than a serialized type.

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?

The description opens with a specific verb and resource ('Append a value to a JSON, YAML or TOML array or a Python module-level list') and enumerates the supported formats. It explicitly sets itself apart from the closest sibling, add_key, so an agent can route correctly without opening either schema.

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?

It uses an explicit 'Use this when / Don't use this when' structure and names the alternative tool (add_key) for the key-value case. The positive condition ('adding a list item') borders on restating the name, and no guidance is given relative to remove_from_array or insert_sibling, so it falls short of a full 5.

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