Skip to main content
Glama

apply_code_patch

Replace an exact code block in a specified file with new code to apply targeted patches. Provide the file path and original snippet to update.

Instructions

Applies a code patch to a specific file by replacing original_code with new_code.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
new_codeYesThe new code block
file_pathYesAbsolute path to the file
original_codeYesThe exact code block to be replaced

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.1.0

TDQS

A3.5/5.0
Behavior3/5

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

The description discloses the core mutation behavior: replacing an exact code block with new code. However, with no annotations and no mention of failure modes (e.g., if original_code is not found), side effects, or success/failure signaling, transparency is incomplete.

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?

One focused sentence with the key action front-loaded. No filler or redundant information.

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?

The tool is simple and the parameter schema covers all inputs, but the description omits what happens on failure, whether replacement is global or first occurrence, and what the tool returns. For a mutation tool with no annotations or output schema, this leaves some ambiguity.

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?

All three parameters have schema descriptions, so the description adds modest semantic value by clarifying the relationship between original_code and new_code. It does not significantly deepen the 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?

Description uses a specific verb ('applies') and clearly identifies the action and resource: replacing original_code with new_code in a file. This clearly distinguishes it from the read-oriented sibling tools.

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

Usage Guidelines2/5

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

No explicit when-to-use, prerequisites, or exclusions are provided. The intended context is only mildly implied by 'applies a code patch'; the sibling alternatives are named in the environment but not differentiated here.

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