KitchenSink4Word
Server Configuration
Describes the environment variables required to run the server.
| Name | Required | Description | Default |
|---|---|---|---|
| KS4W_ALLOWED_ROOTS | No | Optional sandboxing environment variable. Set to a list of directories separated by the OS path separator (; on Windows, : elsewhere), e.g. C:\Users\me\Documents;D:\Work. When set, every path the server touches must resolve inside one of these directories. |
Instructions
Guidance the server publishes about itself, which clients place ahead of the tool catalog so the model reads it before choosing anything.
This server publishes no instructions, or was last inspected before Glama recorded them.
Capabilities
Features and capabilities supported by this server
Protocol revision2025-11-25
| Capability | Details |
|---|---|
| tools | {
"listChanged": true
} |
| logging | {} |
| prompts | {
"listChanged": false
} |
| resources | {
"subscribe": false,
"listChanged": false
} |
| extensions | {
"io.modelcontextprotocol/ui": {}
} |
| experimental | {} |
Tools
Functions exposed to the LLM to take actions
| Name | Description |
|---|---|
| create_documentA | Create a new blank .docx file, optionally setting the title core property. Refuses to overwrite an existing file (use copy_document with overwrite=True for that). Parent directories are created automatically. Populate the document afterward with insert_paragraphs, create_table, define_style (academic pack), and other tools. Template-driven builds live in the assembly pack. |
| copy_documentA | Copy a document byte-for-byte, e.g. to a new DTG-stamped filename before editing (manage_backups action='snapshot' names such a copy for you; this tool takes an explicit dest_path). Refuses an existing dest_path unless overwrite=True; an overwritten destination's previous content rotates into its .ks4w-backups prev slot first, so the overwrite is undoable via manage_backups restore. Split/merge and multi-document work live in the assembly pack. |
| manage_backupsA | Manage the automatic backups under the hidden .ks4w-backups/ folder next to each mutated document: two stable slots per document, prev (state before the most recent mutation) and anchor (session start). action='list': slot files with sizes and mtimes, legacy .bak- files, and orphaned slot folders whose source document is gone; give file_path for one document or directory for a folder. action='restore': overwrite file_path with a backup; source is 'prev', 'anchor', or a legacy .bak- path. The current content rotates into prev FIRST, so a restore is itself undoable; the payload is validated before the atomic replace, and documents open in Word are refused. action='purge': delete backups; scope: 'legacy', 'orphans', or 'slots'. dry_run defaults to TRUE (report only); dry_run=False deletes. Exact paths and sizes are reported either way. action='snapshot': save a DTG-stamped permanent copy of file_path, YYYYMMDD_HHMM_.docx (an existing leading DTG is replaced, not stacked), optional short label suffix, optional dest_dir. Snapshots are permanent keepers: the slots rotate on every mutation, snapshots are never auto-pruned and no purge scope touches them. Never overwrites (collisions get a numeric suffix); the source document is not modified. |
| get_document_infoA | Read a one-call document overview: paragraph/table/footnote/comment/ revision counts, sections, and package parts. Documents open in Word are read live (same key names; live adds 'words' from Word's own ComputeStatistics counter plus track_revisions, and omits the part list). Read-only. |
| diagnose_documentA | Produce a one-call structural health report, read-only: content-type coverage, dangling relationships and orphan parts, field balance per story part, footnote/endnote integrity, references to undefined styles and numbering, content-control and bookmark sanity, duplicate revision ids, missing image targets, broken cross-references, and a per-part size profile. Never fails on a weird-but-openable document; every check degrades to a reported problem, and healthy=false only for problems that render broken or lose content in Word. The deep companion to validate(checks=['core']). No live mode BY DESIGN: this reads the saved package's XML, stale while Word holds unsaved changes. Close the document first, or use com_validate_opens_clean (com-live pack) / live get_document_info. The full validate check battery lives in the academic pack. |
| get_textA | Read body paragraphs as [{index, text, style, ...}] with effective styles. start/end slice by paragraph index (0-based, end EXCLUSIVE); contains filters. include_textboxes=True appends text-box content as labeled extras, body indices untouched; textbox=true (or {"index": n}) returns ONLY text-box content, with the box_index set_textbox_text (media-forms pack) takes; file-mode only. Open documents read live, same shape. Equations read via list_elements type='equations'. Read-only. Orientation: get_document_view. |
| find_textA | Find text in paragraphs and table cells; returns locations plus context. include_textboxes=True also searches text-box content as labeled matches; file-mode only. Pass formatting={...} (bold, font, size_pt, color, ...) to search by EFFECTIVE formatting: resolved through run, style chain, and defaults; query=None returns every formatted stretch; scope 'body' or 'all'; file-mode, no regex. Plain queries search open documents live (same shape, 500-match cap). Read-only. To read a known range, use get_text. |
| get_outlineA | List every heading with its paragraph index and level. Detects Heading styles AND w:outlineLvl overrides (direct or style-inherited); detected_via names which. detect_formatted=True adds a heuristic scan for direct-formatted headings (short bold/centered paragraphs). When nothing is detected, returns a note plus flat structure counts, not an empty list. The indices feed the location object's paragraph and outline selectors. Open documents are read live. Read-only. TOC generation and heading surgery: academic pack. |
| list_elementsA | Enumerate any collection in one call. type: tables | images | charts | equations | bookmarks | sources | sections | section_blocks | footnotes | endnotes | fields | reference_fields | form_fields | content_controls | template_placeholders | index_entries | lists | toc. Returns {type, count, items}; the ids or indices returned are the handles the matching set_/delete_/manage_ tools take (list then act). Highlights per type: tables reports dimensions and the table_index other table tools take; images reports display size and the media target; charts reports series; equations reads math content; bookmarks excludes internal TOC bookmarks; fields covers complex and simple fields with cached results; reference_fields inventories Zotero, EndNote, and Mendeley fields and flags broken pairs; form_fields and content_controls cover legacy fields and SDTs; template_placeholders lists {{name}} and MERGEFIELD keys for fill_template and mail_merge (assembly pack); lists groups list paragraphs by numbering instance; toc returns TOC-family fields with cached entries (refresh via com_refresh_fields, com-live pack, then re-read). filter={"range": {start, end}, "name": "substring"} applies where meaningful; inapplicable filters refuse loudly. Read-only, file mode; close documents open in Word first. Tools for these elements live in packs; enable_tools lists them. To locate a string, find_text. |
| get_workflowsA | Recommended tool sequences for common multi-step tasks, with a one-line why per step. Call with no task to list the available tasks ('process-feedback', 'prepare-submission', 'format-citations', 'build-from-template', 'heavy-editing', 'live-editing', 'comment-partner', 'migrate-from-v1', 'bulk-edit'); call with task='' for that task's step-by-step sequence and notes. Pure guidance: reads nothing, changes nothing. |
| get_server_infoA | Report this server's build and environment: version, the active tool surface (tool count, approximate token bill, per-pack state), the packs enable_tools can load, what decided the startup surface and whether it is locked, whether the Word application tier can run here, whether path sandboxing is on, the host OS and Python, and the update-check state. Needs no document, opens no file, starts no Word. Paste-safe: no path, document name, or user name, so a bug report can carry it as it stands. |
| insert_paragraphsA | Insert paragraphs (items {text, style?, formatting?, heading_level?}) at a location object (omitted = document end). heading_level 1-9 makes the item a heading (level 1 = outline 0). inherit_format/copy_format_from clone neighbor formatting minus outline level (file mode only); track records insertions by author. Auto-backup in file mode; atomic validated save. Open documents edit live, serialized; a stale text-selector target refuses: save in Word, retry. For batches, use apply_edits. |
| delete_paragraphsA | Delete body paragraphs by 0-based inclusive index (start, end; end defaults to start) or by range={start, end} location objects. Refuses ranges cutting a field or a section break; deleting every paragraph leaves one empty one behind. track records tracked deletions. expect_start/expect_end delete nothing unless that index still holds the given text. Auto-backup in file mode (backup=False skips rotation). Open documents edit live (serialized), unsaved until saved. For batches, use apply_edits. |
| set_paragraph_textA | Replace one paragraph's full text, keeping style and base formatting; address it with a location object ({paragraph: N}, {search: ...}, {outline: ...}). Indices shift after edits, so pass expect (a substring the target must contain) to refuse instead of hitting the wrong paragraph; verify the returned replaced_text. Auto-backup in file mode (backup=False skips rotation); atomic validated save. Edits go live on open documents (serialized); tracked-revision paragraphs refuse live. For batches, use apply_edits. |
| search_and_replaceA | Batch find/replace, safe across Word's fragmented runs. Each item: {find, replace, regex?}; scope: body | footnotes | headers | all. preview=true dry-runs the same engine without touching the file: per-item counts, each match with paragraph index and before/after context, the grand total, and the refusals a real run would hit; review, then rerun with max_replacements set to the previewed total so drift aborts instead of over-replacing. find_formatting={bold, italic, font, size_pt, color, highlight, style, ...} restricts replacement to text carrying that effective formatting (file mode only, no regex; an item without find replaces each entire matching stretch, and the replacement keeps the matched formatting). max_replacements aborts, changing nothing, when total matches would exceed it. track records each replacement as a tracked change by author. Sibling: set_paragraph_text rewrites one whole paragraph when a find string would be unwieldy. Live edits appear immediately as one Ctrl+Z step, unsaved until the user saves; the live result adds live:true and skip counters, and literal finds beyond Word's ~255-char limit are handled automatically. Auto-backup in file mode (backup=False skips rotation); atomic validated save. Documents open in Word edit live, serialized; tracked replaces never re-match their own markup. For anchor-scoped edits, use apply_edits. |
| get_document_viewA | Read the document as an anchored markdown projection, the low-token alternative to get_text for orientation and bulk editing. One block per paragraph, prefixed [hex] with a stable anchor id (from w14:paraId, which survives edits elsewhere in the document); headings carry # prefixes, tables render as pipe tables under [t:hex] with cells addressed t:hex:rNcN (1-based). Anchors work in every location object ({"anchor": "hex"}) and in apply_edits ops. scope: {"outline": "3.2"} for one heading's section, or {"paragraphs": {"start": N, "end": M}} (end exclusive); omit for the whole document. detail: "structure" (headings and counts only), "text" (default), "full" (adds {++ins++}/{--del--} revision markers and [cN] comment refs with an author legend). include: {"tables": false} to skip tables, {"notes": "inline"} to append footnote/endnote text. Documents without paraIds get VOLATILE anchors (flagged in the header) that change with any edit; stamp_anchors=true writes real paraIds so anchors become durable. Stamping is the ONE mutation this tool can make and runs only when explicitly requested, with the normal backup and validated save; plain reads never modify the file. A document open in Word is read from its last saved state. To locate a string, use find_text; to enumerate collections, use list_elements. |
| apply_editsA | Apply a batch of anchor-addressed edits in one call: one lock, backup, and validated save for the batch. Anchors come from get_document_view. Ops (each edit has "op"): replace {anchor, find, text, occurrence?} (omitted = every match); set_text {anchor, text} (whole paragraph); insert {location, markdown} (headings, plain paragraphs, lists, and pipe tables become real Word structures; location is the standard object); delete {anchor or anchors}; set_style {anchor, style}; format {anchor, formatting, find?, occurrence?}; set_paragraph_format {anchor, format}; set_cell {anchor: "t:hex:rNcN", text}. The whole batch validates BEFORE anything mutates, against BATCH-START text (never reference text an earlier op creates); one stale anchor refuses it all (STALE_ANCHOR lists failed ops: re-view, resend). The changed map carries per-op results, with fresh anchors for inserted paragraphs, so follow-up batches chain without re-viewing. Ops run in order; keep deletes last. Auto-backup in file mode (backup=False skips rotation); atomic validated save. A document open in Word is edited live as ONE undo step: serialized, validated before any write, rolled back on mid-batch failure. Markdown lists/tables are file-mode only there; stale targets refuse: com_save_document (com-live pack) first, re-view, resend. Use this when a change needs two or more edits; for one, use the standalone tool. |
| format_textA | Apply character formatting or change case on a text range. formatting: bold, italic, underline, strike, font, size_pt, color, highlight, small_caps, char_spacing_pt, language, east_asian_language, and more. case: upper | lower | title | sentence. Target: range={start,end}, find, or both; one of formatting or case per call. Auto-backup in file mode (backup=False skips rotation); atomic validated save. Formatting goes live on open documents (serialized); case is file-mode only. For batches, use apply_edits. |
| set_paragraph_formatA | Set paragraph formatting on a batch: indices (0-based list) OR start/end (inclusive range), exactly one form. Keys: alignment, space_before_pt, space_after_pt, line_spacing, indent_left_pt, indent_right_pt, first_line_indent_pt, keep_with_next, outline_level. outline_level (0-8; null removes) never changes the look; it is off by one from heading_level 1-9. Auto-backup; atomic validated save. Open documents edited live (serialized; shading/borders/tab_stops refused live). For batches, use apply_edits. |
| apply_styleA | Apply a named style. range={start,end} (locations or bare indices) applies a paragraph style to those paragraphs, changing their full look (Heading1-9 auto-created); target={search:{text, occurrence?}} applies a character style to the matched text instead. For an outline level without visual change use set_paragraph_format. Auto-backup (backup=False skips rotation); atomic validated save. Refuses documents open in Word. For batches, use apply_edits. Defining new named styles lives in the academic pack. |
| create_tableA | Create a table from 2D string data with single-line borders and a bold repeating header row (header_row=False for none). location is the standard location object ({paragraph}, {after_heading}, {outline}, {search}, {anchor}); omit it to append at the document end; position 'after' only. To build a table from a CSV or JSON file use import_table (protection-io pack). Auto-backup: prev/anchor slots in .ks4w-backups (backup=False skips rotation only); atomic validated save. Refuses documents open in Word. |
| delete_tableA | Delete a whole table and its contents. table_index is the 0-based position among body-level tables in document order, as reported by list_elements(type='tables') or get_document_view; nested tables are removed with their host table. To clear cell values while keeping the grid, use set_cells instead. Auto-backup: prev/anchor slots in .ks4w-backups (backup=False skips rotation only); atomic validated save. Refuses documents open in Word. |
| get_tableA | Read one table in full: every cell's text, the merge map, and column widths. table_index is 0-based among body-level tables in document order. has_merges=false returns rows of strings; has_merges=true returns {text, grid_span, vmerge} cells. For a table nested inside a cell, pass nested={row, cell, index} addressing the host cell (index picks among several, default 0). Write with set_cells; reshape with modify_table_structure (media-forms pack). Read-only; reads the last-saved state of a document open in Word. |
| set_cellsA | Write many table cells in one call. Modes: edits=[{row, cell, text}] for scattered cells, or block={origin:{row, cell}, values:[[...]]} for a 2D block. nested={row, cell, index} targets a table nested in that host cell (edits mode only). track records tracked changes by author. Live mode (plain edits only) refuses vertical merges; file mode is merge-aware. Auto-backup in file mode (backup=False skips rotation); atomic validated save. Documents open in Word edit live, serialized. For batches, use apply_edits. |
| insert_breakA | Insert a break after the located paragraph. type: page starts a new page; section_next / section_continuous / section_even / section_odd start a new SECTION (own headers, margins, numbering; see set_section_properties, academic pack). location picks the paragraph (omit for document end). Auto-backup: prev/anchor slots in .ks4w-backups (backup=False skips rotation only); atomic validated save. Refuses documents open in Word. |
| insert_listA | Insert a bulleted or numbered list with real bullet/number glyphs (numbering.xml as needed). items: strings or {text, level} dicts (level 0-8 nests); kind: bullet | number. A call makes its own list, so numbering restarts at 1; continue_from (a num_id from list_elements) carries on an existing one and start_at restarts the new one at N. levels sets per-level formats: [{level, format, text, start, suffix, align, indent_pt, hanging_pt, font}], format one of decimal | lowerLetter | upperLetter | lowerRoman | upperRoman | bullet | none, text a label like '%1.%2.'. location picks the insertion point (omit for document end). Auto-backup to .ks4w-backups; atomic validated save. Refuses documents open in Word. |
| delete_elementA | Delete one document element that has no lifecycle tool of its own.
type: equation | image | chart | bookmark | hyperlink | caption |
reference_list | content_control. Address equations, images, charts by
their list_elements index; reference_list (TOC, List of
Tables/Figures, index) by its read order; bookmarks by name (markers
go, the text stays; Word-internal underscore names refused); hyperlinks
by target url in |
| enable_toolsA | Enable optional tool packs mid-session (sessions start lite). Idempotent; reports tokens added. packs = names below or ['everything']; disable_tools reverses it. Task map: cell merges, tables, images, forms -> media-forms; tracked changes, comments -> review; citations -> references; TOC, notes -> academic; document merge -> assembly; PDF, live Word -> com-live; redaction -> protection-io. Packs:
|
| disable_toolsA | Disable previously enabled tool packs for this session and reclaim their context; the lite core always stays on. Idempotent. The result reports the packs just disabled, the approximate tokens removed, and the remaining surface. packs takes the same names as enable_tools (its description carries the menu) or ['everything']. |
Prompts
Interactive templates invoked by user choice
| Name | Description |
|---|---|
No prompts | |
Resources
Contextual data attached and managed by the client
| Name | Description |
|---|---|
No resources | |