Skip to main content
Glama

Edit file

typst_edit_file

Replace exact text in Typst project files with ordered, atomic find-and-replace edits, preserving concurrent collaborator changes by sending only modified spans.

Instructions

Replace exact text in a text file, like a find-and-replace that must match precisely (whitespace included). Each old_string must occur exactly once unless replace_all=true. Edits apply in order; if one fails, nothing is saved. Only the changed span is sent, so concurrent edits by collaborators are preserved.

Input Schema

NameRequiredDescriptionDefault
pathYesProject-relative path like 'chapters/intro.typ', or a file ID
editsYes
project_idYesProject ID from typst_list_projects, e.g. 'pAbC123dEf456gHi789jKl'

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.1.0

TDQS

A3.9/5.0
Behavior4/5

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

Adds real behavior beyond the annotations: atomicity ('if one fails, nothing is saved') and concurrency safety ('only the changed span is sent, so concurrent edits by collaborators are preserved'). These are non-obvious traits an agent cannot infer from destructiveHint=false or idempotentHint=false, though failure modes and error surface are not described.

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?

Four short sentences, each carrying distinct information: match semantics first, then uniqueness rule, then ordering/atomicity, then concurrency rationale. No filler and no repetition of structured fields.

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?

Covers the essential risk areas for a mutation tool with no output schema: what happens on partial failure, why exact matching matters, and how concurrency is handled. Gaps remain around prerequisites (must the file exist? what happens on a missing file) and whether an edit can create a file.

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 67%, and the description compensates by explaining the uniqueness contract on old_string and the effect of replace_all, which the schema only labels generically ('Exact text to find', 'Replace every occurrence'). Ordering semantics of the edits array are also clarified, though the project_id/path resolution rules are left entirely to the schema.

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?

States a specific verb and resource ('Replace exact text in a text file') and clarifies the semantics as exact-match find-and-replace including whitespace. It doesn't explicitly contrast itself with the sibling typst_write_file, which is the main ambiguity an agent would face when choosing between them.

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

Usage Guidelines3/5

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

Provides operational constraints (unique match required unless replace_all=true, edits applied in order) which implies this is the surgical-edit path. However, it never says when to prefer this over typst_write_file or typst_upload_file, and no exclusions are given.

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