Skip to main content
Glama

files_update

Updates a knowledge-base file or a single heading section, writes changes locally, and re-indexes content for full-text search.

Instructions

Rewrite a KB file (project-repo files are refused: kxta never writes into a repo). Default = full-body replacement: content becomes the entire file, triggering disk write + FTS5 re-index. Pass section to instead rewrite ONLY that heading's body (case-insensitive exact-string after trim; the heading line itself is preserved, siblings untouched), saves context budget vs resending the whole file. Throws if section is set but the heading doesn't exist (this mode will NOT create a new section, append the section text via a full-body update first). Operates locally with no external auth or rate limits. Returns the updated file metadata including new estimated token counts.

Input Schema

NameRequiredDescriptionDefault
idYesFile ID
contentYesNew content. With `section` set, this replaces just that heading's body; otherwise it becomes the entire file body.
sectionNoCase-insensitive exact-string heading. When set, only this heading's body is rewritten instead of the whole file.

Schema Changelog

Changes observed during successful MCP inspections.

  1. Addedv6.1.2

TDQS

A4.6/5.0
Behavior5/5

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

With no annotations, the description carries the full burden and does so thoroughly: it discloses the repo-refusal constraint, the disk write + FTS5 re-index side effect, the throw-on-missing-heading behavior, that section mode will NOT create a new section, and the absence of external auth/rate limits. It even describes the return payload.

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?

Dense but front-loaded: the operation and default behavior lead, followed by the section mode, then edge cases and environment notes. Every sentence earns its place, though the single-block paragraph is heavy and could be broken up for scanability.

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?

For a 3-param mutation tool with no annotations and no output schema, the description covers side effects, failure modes, environment constraints, and even the return shape (updated metadata with token counts). Nothing an agent needs to call it correctly is missing.

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 adds real meaning: `content` semantics depend on whether `section` is set, `section` matching is case-insensitive exact-string after trim, and the heading line/siblings are preserved. The throw condition further informs `section` usage.

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+resource ('Rewrite a KB file') and immediately distinguishes the two operating modes (full-body default vs section-scoped rewrite). It also differentiates from files_create by framing it as a rewrite and by the repo-refusal rule.

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?

Gives clear when-to-use guidance for the two modes, including the motivating benefit of `section` (saves context budget) and the failure condition. It stops short of naming a sibling alternative or a general 'when not to use update vs create' rule, which keeps it below a 5.

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