Skip to main content
Glama

insert_field

Insert a Word field after specified anchor text, with safe-code validation, placeholder, and automatic backup. Adds dynamic fields like DATE, PAGE, or SEQ to .docx files.

Instructions

Insert a generic Word field right after after_anchor text (plain paragraph text, literal characters, not XML entities; occurrence picks which match when the anchor appears more than once). field_code examples: 'DATE', 'TIME @ "HH:mm"', 'FILENAME', 'NUMPAGES', 'PAGE', 'SEQ Exhibit * Arabic'. Codes are validated against an allowlist of known-safe fields (document info, page/date/time numbers, SEQ); anything that links out or executes is refused, naming the allowlist. The field is written dirty so Word computes the result on the next refresh; placeholder shows until then. Auto-backup: prev/anchor slots in .ks4w-backups (backup=False skips rotation only); atomic validated save. Refuses documents open in Word.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
backupNo
file_pathYes
field_codeYes
occurrenceNo
placeholderNo
after_anchorYes

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Behavior5/5

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

With no annotations, the description carries the full behavioral burden and does so thoroughly. It discloses dirty writes, placeholder behavior, backup rotation semantics, atomic validated saves, allowlist refusal of unsafe codes, and refusal to operate on documents open in Word.

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?

The description is dense but every sentence earns its place: action, anchor semantics, code examples, validation, dirty-write behavior, backup behavior, and refusal conditions. It is front-loaded with the primary purpose and adds no filler.

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 6-parameter mutation tool with no annotations, the description is exceptionally complete: insertion mechanics, parameter details, validation, persistence semantics, backup behavior, and an open-document failure mode are all covered. An output schema exists, so return-value detail is not needed here.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters5/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 0%, but the description compensates by explaining after_anchor literal-text matching, occurrence selection, field_code validation and examples, backup behavior for backup=False, and the placeholder parameter's temporary display role. This adds substantial meaning beyond the bare schema.

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?

The description states a specific verb and resource: 'Insert a generic Word field right after after_anchor text', and reinforces meaning with concrete field_code examples. It distinguishes this from siblings like insert_citation, com_refresh_fields, and list_fields by emphasizing generic field insertion.

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?

The description gives clear context for use: generic Word fields, anchor-based positioning, and an allowlist restricting to known-safe field types. It does not explicitly name alternatives or when-not-to-use cases, but the phrase 'generic Word field' and validation rules make the intended use reasonably clear.

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

Install Server

Other Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/nometalalchemist/KitchenSink4Word'

If you have feedback or need assistance with the MCP directory API, please join our Discord server