Skip to main content
Glama

Write file

typst_write_file
DestructiveIdempotent

Creates or replaces an entire text file in an online Typst project, and collaborators see changes live. Use for full-file writes, not partial edits.

Instructions

Create a text file or replace its entire content. Collaborators in the web editor see the change live. Prefer typst_edit_file for changes to part of an existing file. Folders are created implicitly by the path.

Input Schema

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

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.1.0

TDQS

A4.4/5.0
Behavior4/5

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

Annotations already declare destructiveHint=true and idempotentHint=true, so the safety profile is covered; the description still adds real context: the write replaces the entire content (what gets destroyed), folders are auto-created, and collaborators see the change live in the web editor. It stops short of stating permission/auth requirements or that a new file is created when the path does not exist.

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?

Three short sentences, front-loaded with the core action, then the sibling routing rule, then the folder-creation aside. Nothing is redundant with the title or schema.

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?

For a destructive whole-file write with no output schema and full parameter coverage, the description covers the essentials: overwrite semantics, live-collaboration side effect, implicit directory creation, and the correct alternative. Only authorization/precondition behavior for a nonexistent path or ID-based path is unaddressed.

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?

Schema coverage is 100%, so path/content/project_id are already documented in the schema, making 3 the baseline. The one added semantic is that the path implicitly creates folders, which is genuinely useful but only touches a single parameter.

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?

States a specific verb and resource ('Create a text file or replace its entire content') and distinguishes itself from typst_edit_file, typst_upload_file and typst_read_file by naming the partial-edit sibling directly. An agent can pick between write and edit without opening either 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?

Names the alternative (typst_edit_file) and the exact condition that selects it ('changes to part of an existing file'), implying whole-file rewrites belong here. No exclusions are left to inference for the main confusion risk among the file tools.

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