Skip to main content
Glama

delete_key

Delete a key-value pair from JSON, YAML, TOML, Python, or JS/TS files. Automatically removes the trailing comma to maintain syntax validity.

Instructions

Delete a key-value pair from a dict-like container.

  • JSON / YAML / TOML: dotted path to the key.

  • Python (.py) module-level dict literals: target is 'DictName.keyExpr' (e.g. 'CONFIG."timeout"').

  • JS / TS module-level const / let / var object literals (including export const ... = { ... }): target is 'VarName.keyName' or 'VarName."quoted-key"'. Handles both regular { key: value } pairs and shorthand { key } properties.

For JSON and JS/TS, the adjacent comma is also removed to keep the file valid.

Use this when: You want to remove an entire entry. Don't use this when: You want to remove an item from a list/array -> use remove_from_array. You need to edit an inline object literal passed as a function argument (foo({ x })) -- use delete_in_body (Phase 3) scoped to the enclosing function instead.

Example (JSON): target="dependencies.tree-sitter" Example (Python): target='CONFIG."timeout"' Example (TS): target="CONFIG.port" # regular pair target="CONFIG.name" # shorthand { name } target='CONFIG."complex-key"' # quoted key

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
file_pathYes
targetYes

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes
Behavior4/5

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

Describes the deletion action and comma removal for JSON/JS/TS, but does not explicitly state that the file is modified in place or that the action is irreversible. With no annotations, the burden is on the description, and it largely meets it.

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

Conciseness5/5

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

Well-structured with sections, examples, and usage guidelines. Every sentence adds value, no unnecessary repetition.

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?

Covers all relevant aspects: operation, file types, usage context, examples. Output schema exists so return value explanation is not needed. Complete for the given complexity.

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 0%, but the description thoroughly explains the 'target' parameter with file-specific syntax and examples. 'file_path' is not explained, though its purpose is somewhat obvious. Overall, adds significant meaning beyond the schema.

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 clearly states it deletes a key-value pair from dict-like containers, with specific file type support and examples. It distinguishes from siblings like remove_from_array and delete_in_body.

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

Usage Guidelines5/5

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

Explicitly states when to use (remove an entire entry) and when not to use (list removal -> remove_from_array, inline object -> delete_in_body), with alternative tool names.

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

Install Server

Other Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/kambleakash0/ast-editor'

If you have feedback or need assistance with the MCP directory API, please join our Discord server