Edit Template
edit_templateEdit 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
| Name | Required | Description | Default |
|---|---|---|---|
| Changes | Yes | Ordered list of search/replace changes applied sequentially. Changes match against the current content, which 'get_template_content' returns. | |
| TemplateToken | Yes | Template token. Create with 'create_template_draft' or 'get_template' tools. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| Result | Yes | Result of the operation. | |
| UpdatedTemplate | Yes | Updated template content. | |
| UpdatedTemplateToken | Yes | Updated template token. Old token is invalidated. | |
| UpdatedTemplateDataSchema | Yes | Data schema inferred from the updated template. |