Skip to main content
Glama

add_parameter

Add one parameter to an existing function signature without retyping it, placing it at the start or end while respecting language-specific trailing parameters.

Instructions

Add one parameter to a function's signature, keeping the body. "end" puts it after the last parameter but before those that must come after it (Python **kwargs, a JS/TS rest parameter, Go and Java variadics, C/C++ ..., Ruby **opts and &blk); "start" before the first, but after a TS this or Java receiver parameter. A list written one parameter per line gets it on a line of its own, a C (void) takes it in place of void, and a bare JS/TS arrow parameter gets parentheses. A name the function already has is refused.

Use this when: adding a parameter without retyping the signature. Don't use this when: rewriting the signature (replace_signature), or changing the body too (replace_function).

Example (def f(a, **kw) becomes def f(a, b, **kw)): target="f" parameter="b"

Input Schema

NameRequiredDescriptionDefault
targetYesFunction or method name as list_symbols lists it, dotted for nesting ('LRUCache.get'); overloads take parameter types ('A.m(int)').
positionNo'end' (default) after the last parameter, before any that must stay last; 'start' before the first. Other values are refused.end
file_pathYesAbsolute path to the source or config file.
parameterYesSource text of one parameter (e.g. 'default=None', 'const int* buf'); the comma is added for you.

Output Schema

NameRequiredDescriptionDefault
resultYes

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed4 schema fields changedv3.2.0
    • addedInput schema / properties / file_path / description
      Added value: +"Absolute path to the source or config file."
    • addedInput schema / properties / parameter / description
      Added value: +"Source text of one parameter (e.g. 'default=None', 'const int* buf'); the comma is added for you."
    • addedInput schema / properties / position / description
      Added value: +"'end' (default) after the last parameter, before any that must stay last; 'start' before the first. Other values are refused."
    • addedInput schema / properties / target / description
      Added value: +"Function or method name as list_symbols lists it, dotted for nesting ('LRUCache.get'); overloads take parameter types ('A.m(int)')."
  2. First observedv2.0.1

TDQS

A4.6/5.0
Behavior4/5

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

Annotations cover the safety profile (readOnlyHint=false, destructiveHint=false) but say nothing about semantics. The description adds real behavioral detail the annotations cannot: language-specific placement rules for 'end'/'start', formatting side effects (one-param-per-line, C `(void)` replacement, arrow-function parenthesization), and the duplicate-name refusal. It stops short of stating that the file is rewritten in place or what the response contains, which keeps it at 4 rather than 5.

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 the purpose, then when/when-not, then a worked example — a good ordering with no filler sentences. The long parenthetical enumerating every language's trailing constructs is justified but dense, slightly weighing down the opening sentence.

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 full schema coverage, an output schema, and safety annotations already supplied, the description fills the remaining gaps: exact placement behavior, refusal cases, and formatting side effects. An agent has everything needed to call it correctly on the first try.

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 baseline is 3, but the description goes further by explaining concretely what 'end' and 'start' mean per language ('before those that must come after it… Python **kwargs, a JS/TS rest parameter…') and by showing an example mapping target/parameter to a before/after signature. This adds meaning beyond the schema's abstract wording.

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?

Opens with a precise verb + resource scope: 'Add one parameter to a function's signature, keeping the body.' That single clause distinguishes it from remove_parameter, replace_signature and replace_function_body without needing to open any schema.

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?

Explicit 'Use this when: adding a parameter without retyping the signature' and 'Don't use this when: rewriting the signature (replace_signature), or changing the body too (replace_function)' — naming both alternatives and the condition that selects them.

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