Skip to main content
Glama

Edit Template

edit_template

Edit a template using ordered search/replace changes. On success, modified template draft token is returned while old template token is invalidated.

Each change locates an exact OldString substring in the current template content and replaces it with NewString. OldString MUST be unique in the current content; include surrounding context (entire lines, nearby tags) until it is unique. Changes apply sequentially: each change sees the result of all previous changes.

  • To insert: set OldString to a unique anchor that already exists, set NewString to that same anchor plus the inserted text.

  • To delete: set NewString to an empty string.

Changes match against the current content, which 'get_template_content' returns. 'template_format' documents the template format.

Example tool call

This call uses example arguments supplied in the tool’s input schema.

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {
      "Changes": [
        {
          "NewString": "Subject: Hello {{.Name}}",
          "OldString": "Subject: Hello"
        }
      ],
      "TemplateToken": "A3K7NP"
    },
    "name": "edit_template"
  }
}

Input Schema

NameRequiredDescriptionDefault
ChangesYesOrdered list of search/replace changes applied sequentially. Changes match against the current content, which 'get_template_content' returns.
TemplateTokenYesTemplate token. Create with 'create_template_draft' or 'get_template' tools.

Output Schema

NameRequiredDescriptionDefault
ResultYesResult of the operation.
UpdatedTemplateYesUpdated template content.
UpdatedTemplateTokenYesUpdated template token. Old token is invalidated.
UpdatedTemplateDataSchemaYesData schema inferred from the updated template.

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observed

TDQS

A4/5.0
Behavior4/5

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

Going beyond the annotations, it discloses the token lifecycle — a new draft token is returned and the old token is invalidated — which is critical and non-obvious for a non-idempotent, non-read-only mutation. It also explains sequential application semantics (each change sees prior results), a real behavioral trait. It stops short of describing failure behavior when OldString is missing or ambiguous.

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 and outcome before the mechanics, and the bullet list for insert/delete is scannable. There is some duplication with the schema — the Changes description repeats the 'matches against the current content, which get_template_content returns' sentence verbatim — but no sentence is wasted.

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?

With an output schema present, the return value need not be described, yet the token-invalidation outcome is covered anyway. Combined with 100% schema description coverage, an agent has what it needs to construct a valid call; only error conditions for non-unique or missing OldString remain unspecified.

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 baseline is 3; the description nonetheless adds ordering semantics for Changes (applied sequentially, each seeing previous results) and the OldString uniqueness contract with a workaround. TemplateToken handling is left to the schema, including its pattern and one-time-use format.

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

Purpose4/5

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

The first sentence names a specific verb (edit), resource (template) and mechanism (ordered search/replace changes), which is far more precise than the bare title. It does not explicitly contrast itself with near siblings like save_template or create_template_draft, so an agent must infer that those are full-content replacement rather than diff-based edits.

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?

Concrete guidance is given for the non-obvious cases: inserting via an existing anchor, deleting via an empty NewString, and the uniqueness requirement with a remedy (add surrounding context). It also routes the agent to get_template_content for the current content and template_format for format details, though it never states when to prefer this tool over save_template.

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.