office-live-mcp
v1.2.3MCP server that lets AI assistants manipulate live, open Word, Excel and PowerPoint documents via Office.js
These tools were reported by the server itself during our smoke test (tools/list), not copied from the README.
list_presentations
Lists all PowerPoint presentations currently connected to the bridge server. Shows presentation IDs (file paths for saved files, generated IDs for unsaved) and connection status. Use this to find the presentationId to pass to other tools when multiple presentations are open.
inspect_deck
Deck overview: slide dimensions, theme (colors + fonts), and all slides with slide number (1-based), ID, and shape count. Use as the first call to understand deck structure. Theme is cached after the first call. For shape details, follow up with scan_slide or inspect_slide on specific slides. For available layouts, use inspect_layouts.
| Parameter | Type | Description |
|---|---|---|
presentationId | string | Target presentation ID from list_presentations. Optional when only one presentation is connected. |
inspect_layouts
Returns slide layouts with names, OOXML type (e.g. blank, twoObj, secHead), master/layout indices, and detailed placeholders. Use `fields` to control which data is returned. By default reads all layouts from every slide master in OOXML (complete list, requires file access — may take a moment on first call for cloud files). Layouts sharing a name across different masters are distinguished by `masterIndex`. Set usedOnly to return only layouts assigned to existing slides (fast, Office.js only, no file access).
| Parameter | Type | Description |
|---|---|---|
fields | string | Comma-separated layout fields to include. Placeholders sub-fields in parens. Default: "index,masterIndex,name,type,usedBySlides,placeholders(type,idx,name)". All placeholder fields: type,idx,name,desc… |
presentationId | string | Target presentation ID from list_presentations. Optional when only one presentation is connected. |
usedOnly | boolean | If true, return only layouts currently assigned to slides (fast, Office.js only). Default: false (all layouts from OOXML). |
inspect_slide
Detailed slide inspector (~80 tokens/shape): returns every shape with text content, positions, sizes, and fill colors, plus slide dimensions. Supports slideRange for multiple slides. For just positions without text/fills, use scan_slide instead.
| Parameter | Type | Description |
|---|---|---|
slideRange * | string | Slide numbers, 1-based, e.g. "1", "1-5", "2,4,7". Single number or range. |
presentationId | string | Target presentation ID from list_presentations. Optional when only one presentation is connected. |
scan_slide
Lightweight shape scanner (~40 tokens/shape): lists shape IDs, types, and positions on slides, plus slide dimensions. Supports slideRange for multiple slides. For text content and fills, use inspect_slide instead.
| Parameter | Type | Description |
|---|---|---|
slideRange * | string | Slide numbers, 1-based, e.g. "1", "1-5", "2,4,7". Single number or range. |
namePattern | string | Glob-style filter on shape name, e.g. "Title*", "*_source", "Card*_bg". Case-insensitive. |
presentationId | string | Target presentation ID from list_presentations. Optional when only one presentation is connected. |
shapeType | string | Filter by shape type: "Placeholder", "TextBox", "GeometricShape", "Graphic", "Picture", etc. |
screenshot_slide
Slide screenshot (~1000 tokens): captures one slide as PNG image. Use to visually verify layout after changes. Do NOT loop over all slides — use preview_deck instead. WARNING: renders with whatever font the host webview substitutes when the deck font is not system-installed (e.g. Century Gothic) — substituted fonts have different metrics, so text width, overflow and centering judgments from these screenshots are UNRELIABLE. For font-faithful QA export via PowerPoint itself (AppleScript: `save pres in POSIX file "/tmp/x.pdf" as save as PDF`, then pdftoppm) and measure geometry with Python (…
| Parameter | Type | Description |
|---|---|---|
slide * | integer | Slide number, 1-based (slide 1 = first slide), from scan_slide results |
height | integer | Image height in pixels. If omitted, auto-calculated from width to preserve aspect ratio. |
presentationId | string | Target presentation ID from list_presentations. Optional when only one presentation is connected. |
width | integer | Image width in pixels. Default: 720. Height auto-calculated to preserve aspect ratio unless also specified. |
preview_deck
Deck preview: batch overview of all/selected slides with optional thumbnails + text. With images: ~900 tokens/slide; text-only (includeImages=false): ~35 tokens/slide. Use for visual review or content audit. Do NOT use to inspect one slide — use inspect_slide or screenshot_slide instead.
| Parameter | Type | Description |
|---|---|---|
imageWidth | integer | Thumbnail width in pixels. Default: 480. Height auto-calculated to preserve aspect ratio. |
includeImages | boolean | Include slide thumbnails. Default: true. Set false for text-only overview (faster). |
presentationId | string | Target presentation ID from list_presentations. Optional when only one presentation is connected. |
slideRange | string | Slide numbers, 1-based, e.g. "1-6", "2,4,7", "1-3,5,8-11". Omit for all slides. |
open_document
Open a document file (.pptx/.docx/.xlsx) as a NEW document in its Office app (PowerPoint, Word or Excel) on the machine where the bridge runs. Only use this when the user explicitly wants a separate new document/window — it does NOT fill a presentation they already have open. To deliver a built deck into the user's open presentation, use import_presentation_file instead.
| Parameter | Type | Description |
|---|---|---|
path * | string | Absolute path to the document file. It must already exist on this machine. |
import_presentation_file
Import ALL slides from a .pptx file on disk into a connected live PowerPoint presentation, in one atomic operation. The file is read server-side (its Base64 never enters the model context) and inserted via insertSlidesFromBase64 — the slides appear live in the open presentation while the user watches. This is the route for "build me a full presentation INTO this open deck": generate the complete .pptx offline (e.g. python-pptx), then import it into the connected presentation. No second pane or ribbon click needed.
| Parameter | Type | Description |
|---|---|---|
path * | string | Absolute path to the source .pptx file. It must already exist on this machine. |
formatting | string | Formatting mode for the inserted slides. Default: KeepSourceFormatting. |
presentationId | string | Destination presentation ID from list_presentations. Optional when only one presentation is connected. |
add_connector
Draw a line or curved connector between two shapes or points, with all OOXML bounding-box math (off/ext/flips, bezier path) computed for you. For bezier curves the path leaves and arrives horizontally — no flip attributes are used, avoiding the custGeom double-mirror pitfall. The shape is appended on top of the slide.
| Parameter | Type | Description |
|---|---|---|
from * | Endpoint: {shapeId} or {x, y} | |
slide * | integer | Slide number, 1-based |
to * | Endpoint: {shapeId} or {x, y} | |
alphaPct | number | Opacity in percent (0-100). Omit for fully opaque. |
beforeShapeId | string | Insert the connector directly below this shape ID (z-order). Overrides zOrder. |
color | string | Line color as RRGGBB hex, e.g. "EF463C". Default EF463C. |
curve | string | straight (default) or bezier (horizontal tangents at both ends). |
presentationId | string | Target presentation ID. Optional when only one presentation is connected. |
weightPt | number | Line width in points. Default 1. |
zOrder | string | "top" (default) appends above all shapes; "bottom" inserts below all shapes. |
transform_slide
Vertically rescale a band of shapes (e.g. shrink the content of a slide by 30%) in ONE atomic operation. Shapes whose top falls inside [topPt, bottomPt] are remapped to start at newTopPt with factor scaleY. Connector-like shapes (cxnSp, line/connector geometries, single-stroke bezier custGeom) get their height rescaled too so endpoints stay attached; all other shapes keep their height unless listed in scaleHeightShapeIds. Text, images and footers outside the band are untouched.
| Parameter | Type | Description |
|---|---|---|
bottomPt * | number | Bottom of the band to transform, in points. |
scaleY * | number | Vertical scale factor, e.g. 0.7 = 30% shorter. |
slide * | integer | Slide number, 1-based |
topPt * | number | Top of the band to transform, in points (slide is 960x540 pt). |
newTopPt | number | Where the top of the scaled band should land. Default: keep topPt. |
presentationId | string | Target presentation ID. Optional when only one presentation is connected. |
scaleHeightShapeIds | array | Shape IDs (from scan_slide) whose height should scale with the band (e.g. the two big panel rectangles). |
show_slide
Bring a slide into view in the live presentation (navigates the user to that slide). Call this BEFORE editing a slide so the user can watch the changes happen; also useful to walk the user through a deck slide by slide.
| Parameter | Type | Description |
|---|---|---|
slide * | integer | Slide number, 1-based (slide 1 = first slide). |
presentationId | string | Target presentation ID from list_presentations. Optional when only one presentation is connected. |
add_slide
Add a new slide from a layout at a specific position, with placeholder text pre-filled and shapes renamed to layout names. Use inspect_layouts to find available layout names and placeholder names. Returns the new slide number (1-based) and its placeholder shapes with semantic names.
| Parameter | Type | Description |
|---|---|---|
layoutName * | string | Layout name from inspect_layouts (e.g. "Title and Content", "Section Header"). Case-insensitive match. Layouts starting with "_" are rejected (technical layouts). |
placeholders | object | Map of layout placeholder name → text content. E.g. {"section_title": "Backup Slides", "section_subtitle": "Evidence & appendix"}. Names must match layout placeholder names from inspect_layouts. |
position | integer | 1-based insertion position (position 1 = the new slide becomes the first slide; existing slides shift right). Default: append at end. |
presentationId | string | Target presentation ID from list_presentations. Optional when only one presentation is connected. |
duplicate_slide
Duplicate a slide within the same presentation. Exports the slide and reimports it at the specified position. Data stays server-side. The reimport makes PowerPoint view jump to the first slide.
| Parameter | Type | Description |
|---|---|---|
slide * | integer | Slide number, 1-based (slide 1 = first slide), of the slide to duplicate |
insertAfterSlide | integer | 1-based slide number to insert the duplicate after. Default: same as slide (duplicate appears right after the source). |
presentationId | string | Target presentation ID from list_presentations. Optional when only one presentation is connected. |
copy_slides
Copies slides between two open presentations entirely server-side — the Base64 data never enters Claude context. Exports from the source presentation and inserts into the destination in a single operation. Both presentations must be connected to the bridge. Requires PowerPointApi 1.8.
| Parameter | Type | Description |
|---|---|---|
destinationPresentationId * | string | Destination presentation ID from list_presentations |
sourcePresentationId * | string | Source presentation ID from list_presentations |
sourceSlide * | integer | Slide number, 1-based (slide 1 = first slide), to copy from the source presentation |
formatting | string | Formatting mode. Default: KeepSourceFormatting. |
targetSlideId | string | Insert after this slide ID in destination (format: "nnn#" or "#mmmmmmmmm" or "nnn#mmmmmmmmm"). If omitted, inserts at the beginning. |
edit_shape_paragraphs
Replace paragraph content of a shape with raw OOXML <a:p> XML. Preserves <a:bodyPr> and <a:lstStyle>. Use read_shape_paragraphs first to get the current XML, modify it (using /pptx skill knowledge), then write it back. The slide is exported, modified server-side, and reimported — data never enters Claude's context. NOTE: the reimport deletes and reinserts the slide, but the view is restored to the edited slide afterwards. For text-only changes, execute_officejs still avoids the reimport entirely (in place via shape.textFrame.textRange).
| Parameter | Type | Description |
|---|---|---|
shapeId * | string | Shape ID from inspect_slide results |
slide * | integer | Slide number, 1-based (slide 1 = first slide) |
xml * | string | The <a:p> paragraph XML to replace the current text body content with |
presentationId | string | Target presentation ID from list_presentations. Optional when only one presentation is connected. |
read_shape_paragraphs
Read raw OOXML <a:p> paragraphs from a shape's text body. Returns the paragraph XML as a string — preserves all formatting (bold, colors, bullets, etc.) that textRange.text strips. Use with the /pptx skill's OOXML knowledge to understand and modify the XML.
| Parameter | Type | Description |
|---|---|---|
shapeId * | string | Shape ID from inspect_slide results (e.g. "5") |
slide * | integer | Slide number, 1-based (slide 1 = first slide), from scan_slide results |
presentationId | string | Target presentation ID from list_presentations. Optional when only one presentation is connected. |
read_deck_text
Lightweight text extractor: returns slide titles and body text as plain strings (~20x smaller than inspect_slide). Use for content review, narrative analysis, or any read-only text task. Supports slideRange and optional speaker notes.
| Parameter | Type | Description |
|---|---|---|
includeNotes | boolean | Include speaker notes. Default: false. |
presentationId | string | Target presentation ID from list_presentations. Optional when only one presentation is connected. |
slideRange | string | Slide numbers, 1-based, e.g. "1", "1-5", "2,4,7". Omit for all slides. |
search_text
Search for text across all slides (or a slide range) in the presentation — like grep for slides. Searches shape text, table cells, and speaker notes. Returns matching shapes with context at the chosen level. Case-insensitive substring by default; supports regex.
| Parameter | Type | Description |
|---|---|---|
query * | string | Text to search for. Plain substring by default, or a regex pattern when regex=true. |
caseSensitive | boolean | Case-sensitive search. Default: false. |
context | string | Result detail level. "shape" (default): matching shapes with text. "slide": all shapes on matching slides with matched markers. "none": just matching slide indices. |
includeNotes | boolean | Search speaker notes in addition to slide content. Default: true. |
presentationId | string | Target presentation ID from list_presentations. Optional when only one presentation is connected. |
regex | boolean | Treat query as a regular expression. Default: false (plain substring). |
slideRange | string | Optional slide range to search, e.g. "1-5" or "2-8". Slide numbers are 1-based. Omit to search all slides. |
format_shapes
Apply formatting to multiple shapes on a slide in one call. Generates Office.js code internally. Use for fill color, font bold/italic/size/color/name. Cannot set corner radius or borders (use edit_slide_xml code mode for those). Runs in place (no slide reimport), so PowerPoint view position is preserved.
| Parameter | Type | Description |
|---|---|---|
shapes * | array | Shapes to format with their properties |
slide * | integer | Slide number, 1-based (slide 1 = first slide) |
presentationId | string | Target presentation ID from list_presentations. Optional when only one presentation is connected. |
edit_slide_xml
Edit slide XML and reimport. Two modes: (1) xml mode — provide finished XML string (use read_slide_xml first to get current XML), (2) code mode — provide JS code that manipulates the pre-parsed DOM (receives: doc, findShapeById, NS_P, NS_A, escapeXml, serializeXml, DOMParser). Code mode preserves untouched attributes. The slide is exported, modified server-side, and reimported — data never enters Claude's context. NOTE: the reimport deletes and reinserts the slide, but the view is restored to the edited slide afterwards — reserve this for structural changes (new shapes, layout rebuilds…
| Parameter | Type | Description |
|---|---|---|
slide * | integer | Slide number, 1-based (slide 1 = first slide) |
code | string | JS code that manipulates the pre-parsed slide DOM. Receives: doc (Document), findShapeById(id) → Element|null, NS_P, NS_A (namespace strings), escapeXml(text), serializeXml(node), DOMParser. Mutuall… |
explanation | string | Brief description of what the code does (for logging, max 50 chars). Only used with code mode. |
presentationId | string | Target presentation ID from list_presentations. Optional when only one presentation is connected. |
shapeId | string | Optional shape ID (xml mode only). If provided, replaces only that shape's <p:sp> element instead of the full slide XML. |
xml | string | Modified XML — full slide XML or a single shape's <p:sp> element (when shapeId is provided). Mutually exclusive with 'code'. |
edit_slide_zip
Update multiple files in the slide zip and reimport in a single operation. Accepts a map of { path: content } — can modify existing files or add new ones (e.g. chart XML + rels). Auto-registers Content_Types for new chart files. Use read_slide_zip first to get the current content.
| Parameter | Type | Description |
|---|---|---|
files * | object | Map of { zipPath: newContent }. Can include existing paths (to modify) or new paths (to add). Example: { "ppt/slides/slide1.xml": "<p:sld>...</p:sld>", "ppt/charts/chart1.xml": "<c:chartSpace>...</c:c… |
slide * | integer | Slide number, 1-based (slide 1 = first slide) |
presentationId | string | Target presentation ID from list_presentations. Optional when only one presentation is connected. |
read_slide_xml
Read the full raw OOXML of a slide, or filter to a specific shape. Returns the slide's ppt/slides/slide1.xml content. Use with the /pptx skill's OOXML knowledge to understand the XML structure.
| Parameter | Type | Description |
|---|---|---|
slide * | integer | Slide number, 1-based (slide 1 = first slide), from scan_slide results |
presentationId | string | Target presentation ID from list_presentations. Optional when only one presentation is connected. |
shapeId | string | Optional shape ID to filter to. If provided, returns only that shape's <p:sp> element. |
read_slide_zip
Read multiple files from the exported slide zip. Returns slide XML, relationships, chart XMLs, and Content_Types. Use this to inspect chart data, rels, or other zip contents beyond what read_slide_xml provides. When no paths specified, auto-discovers all text/XML files in the zip.
| Parameter | Type | Description |
|---|---|---|
slide * | integer | Slide number, 1-based (slide 1 = first slide) |
paths | array | Specific zip paths to read (e.g. ["ppt/slides/slide1.xml", "ppt/charts/chart1.xml"]). If omitted, auto-discovers all text/XML files. |
presentationId | string | Target presentation ID from list_presentations. Optional when only one presentation is connected. |
edit_speaker_notes
Set speaker notes on one or more slides. Accepts markdown text (paragraphs, **bold**, *italic*). Converts to OOXML server-side and injects via single-slide reimport. Replaces all existing notes on the specified slides.
| Parameter | Type | Description |
|---|---|---|
notes * | array | Array of slide notes to set. |
presentationId | string | Target presentation ID from list_presentations. Optional when only one presentation is connected. |
read_speaker_notes
Read speaker notes from slides. Uses full-deck export (cached by revision) to parse notes from OOXML — Office.js has no notes API. Returns plain text per slide.
| Parameter | Type | Description |
|---|---|---|
presentationId | string | Target presentation ID from list_presentations. Optional when only one presentation is connected. |
slideRange | string | Slide numbers, 1-based, e.g. "1", "1-5", "2,4,7". Omit to read all slides. |
edit_slide_chart
Create a chart on a slide from structured data. Generates all OOXML automatically (chart XML, rels, graphic frame, Content_Types). Supports column, bar, line, pie, doughnut, and area charts with multiple series.
| Parameter | Type | Description |
|---|---|---|
categories * | array | Category labels (x-axis or pie slices) |
chartType * | string | Chart type |
series * | array | Data series |
slide * | integer | Slide number, 1-based (slide 1 = first slide) |
title * | string | Chart title |
options | object | Chart options |
position | object | Chart position in points. Defaults to centered on slide. |
presentationId | string | Target presentation ID from list_presentations. Optional when only one presentation is connected. |
insert_image
Inserts an image onto a slide using Office.js setSelectedDataAsync with CoercionType.Image. Accepts a file path, URL, or raw base64 data. Optionally target a specific slide (the view stays there so the user sees the insert; call show_slide first per the view etiquette) and control position/size in points.
| Parameter | Type | Description |
|---|---|---|
source * | string | File path, URL, or base64 image data depending on sourceType |
sourceType * | string | How to interpret source: "file" reads from disk, "url" fetches from network, "base64" uses data directly |
color | string | Hex color to tint SVG images (e.g. "#FF5733"). Only applies to SVG sources. Works best with mono/outline icons. |
height | number | Image height in points |
left | number | Horizontal position in points (1 point = 1/72 inch) |
presentationId | string | Target presentation ID from list_presentations. Optional when only one presentation is connected. |
slide | integer | Slide number, 1-based (slide 1 = first slide), to navigate to before inserting. If omitted, inserts on the currently active slide. |
top | number | Vertical position in points |
width | number | Image width in points |
get_local_copy
Returns a local file path for the presentation. For local files, returns the existing path. For SharePoint/cloud files, exports server-side and saves to a temp .pptx. Caches by revision number — re-exports only when the presentation has been saved since last export.
| Parameter | Type | Description |
|---|---|---|
presentationId | string | Target presentation ID from list_presentations. Optional when only one presentation is connected. |
search_fluent_icons
Search Microsoft Fluent UI icon library. Returns matching icons with svgBase64 ready for insert_image (sourceType: "base64") — the SVG content is fetched server-side so dead icon URLs can never break the workflow. Prefer mono (_M) variants for professional decks. Retry with synonyms if no good matches (e.g. "innovation" → "lightbulb", "security" → "shield").
| Parameter | Type | Description |
|---|---|---|
query * | string | Search query (e.g. "warning", "arrow down", "lightbulb") |
includeSvg | boolean | Fetch the SVG content for each result (default true, capped at 6 fetches). Set false for a URL-only listing. |
style | string | Filter by style: "regular" for mono/outline icons, "filled" for solid icons. Omit for both. |
top | integer | Max results to return (default 10) |
execute_officejs
Execute arbitrary Office.js code inside the live PowerPoint presentation. The code runs inside PowerPoint.run(async (context) => { ... }) with 'context' available as a variable. Use 'await context.sync()' after loading properties. Return a value to get it back as the tool result. For positioning, all values are in points (1 point = 1/72 inch). Common operations: add shapes, set text, change colors, add/delete slides. Edits run in place without reimporting the slide, so PowerPoint's current view position is preserved — prefer this over edit_shape_paragraphs / edit_slide_xml for text-only or f…
| Parameter | Type | Description |
|---|---|---|
code * | string | Office.js code to execute. Runs inside PowerPoint.run() with 'context' available. Use 'return' to send back a result. |
presentationId | string | Target presentation ID from list_presentations. Optional when only one presentation is connected. |
verify_slides
Run programmatic checks on a slide: detect overlapping shapes, out-of-bounds shapes, empty text, tiny shapes, unused placeholders, placeholder drift from layout defaults, and full-bleed background covers. Returns a list of issues found. Uses the same shape data as inspect_slide — no OOXML needed.
| Parameter | Type | Description |
|---|---|---|
slide * | integer | Slide number, 1-based (slide 1 = first slide) |
checks | array | Checks to run. Default: all checks. |
presentationId | string | Target presentation ID from list_presentations. Optional when only one presentation is connected. |
list_documents
Lists all Word documents currently connected to the bridge server. Shows document IDs (file paths for saved files, generated IDs for unsaved) and connection status. Use this to find the documentId to pass to other Word tools when multiple documents are open.
execute_wordjs
Execute arbitrary Office.js code inside the live Word document. The code runs inside Word.run(async (context) => { ... }) with 'context' available as a variable. Use 'await context.sync()' after loading properties. Return a value to get it back as the tool result. Common operations: read the body (context.document.body), insert paragraphs, search and replace, work with tables, read tracked changes.
| Parameter | Type | Description |
|---|---|---|
code * | string | Office.js code to execute. Runs inside Word.run() with 'context' available. Use 'return' to send back a result. |
documentId | string | Target document ID from list_documents. Optional when only one document is connected. |
inspect_document
Overview of the live document: paragraph count, section count, table count, inline picture count, and a preview of the first paragraphs with their styles. Use this first to orient yourself in an unfamiliar document.
| Parameter | Type | Description |
|---|---|---|
documentId | string | Target document ID from list_documents. Optional when only one document is connected. |
previewParagraphs | integer | How many paragraphs to preview. Default 10. |
read_paragraphs
Read paragraphs of the document with their styles, paginated by offset and limit. Returns total count plus the requested slice.
| Parameter | Type | Description |
|---|---|---|
documentId | string | Target document ID from list_documents. Optional when only one document is connected. |
limit | integer | Maximum paragraphs to return. Default 50. |
offset | integer | First paragraph index to return. Default 0. |
get_paragraph
Read one paragraph in full: text, style, alignment and font properties (name, size, bold, italic, color).
| Parameter | Type | Description |
|---|---|---|
index * | integer | Zero-based paragraph index. |
documentId | string | Target document ID from list_documents. Optional when only one document is connected. |
insert_paragraph
Insert a new paragraph into the document, optionally with a style (e.g. "Heading 1", "Title", "Quote"). Insert at the start or end of the body, or before/after a given paragraph index. Returns the new paragraph count.
| Parameter | Type | Description |
|---|---|---|
text * | string | Paragraph text. Use empty string for a blank paragraph. |
documentId | string | Target document ID from list_documents. Optional when only one document is connected. |
index | integer | Paragraph index for location beforeIndex/afterIndex. |
location | string | Where to insert. Default "end". |
style | string | Style name, e.g. "Heading 1", "Heading 2", "Title", "Quote", "Normal". Built-in names are matched locale-independently. |
set_paragraph_text
Replace the text of one paragraph, keeping the paragraph itself (and optionally its style).
| Parameter | Type | Description |
|---|---|---|
index * | integer | Zero-based paragraph index. |
text * | string | New paragraph text. |
documentId | string | Target document ID from list_documents. Optional when only one document is connected. |
delete_paragraph
Delete one paragraph (text and paragraph mark) from the document.
| Parameter | Type | Description |
|---|---|---|
index * | integer | Zero-based paragraph index. |
documentId | string | Target document ID from list_documents. Optional when only one document is connected. |
format_paragraph
Format one paragraph: style, alignment, and font (name, size, bold, italic, color, highlight color). Only provided properties are changed.
| Parameter | Type | Description |
|---|---|---|
index * | integer | Zero-based paragraph index. |
alignment | string | Paragraph alignment. |
bold | boolean | Bold text. |
color | string | Font color as #RRGGBB. |
documentId | string | Target document ID from list_documents. Optional when only one document is connected. |
fontName | string | Font family, e.g. "Calibri". |
fontSize | number | Font size in points. |
highlightColor | string | Highlight color as #RRGGBB. Use "#FFFFFF" to clear. |
italic | boolean | Italic text. |
style | string | Style name, e.g. "Heading 1". Built-in names matched locale-independently. |
search_document
Search the document body for text. Returns up to 50 matches with a text snippet around each hit.
| Parameter | Type | Description |
|---|---|---|
text * | string | Text to find. |
documentId | string | Target document ID from list_documents. Optional when only one document is connected. |
matchCase | boolean | Case-sensitive search. Default false. |
replace_text
Find and replace text throughout the document. Returns the number of replacements made.
| Parameter | Type | Description |
|---|---|---|
find * | string | Text to find. |
replace * | string | Replacement text. |
documentId | string | Target document ID from list_documents. Optional when only one document is connected. |
matchCase | boolean | Case-sensitive search. Default false. |
insert_table
Insert a table at the end of the document, optionally pre-filled from a 2D array of strings. Returns row and column counts.
| Parameter | Type | Description |
|---|---|---|
columns * | integer | Number of columns. |
rows * | integer | Number of rows. |
documentId | string | Target document ID from list_documents. Optional when only one document is connected. |
values | array | Optional 2D array of cell texts (rows x columns) to pre-fill the table. |
read_table
Read all cell texts of a table as a 2D array.
| Parameter | Type | Description |
|---|---|---|
tableIndex * | integer | Zero-based table index. |
documentId | string | Target document ID from list_documents. Optional when only one document is connected. |
set_table_cell
Write text into one table cell (replacing its content).
| Parameter | Type | Description |
|---|---|---|
column * | integer | Zero-based column index. |
row * | integer | Zero-based row index. |
tableIndex * | integer | Zero-based table index. |
text * | string | New cell text. |
documentId | string | Target document ID from list_documents. Optional when only one document is connected. |
insert_page_break
Insert a page break at the end of the document body.
| Parameter | Type | Description |
|---|---|---|
documentId | string | Target document ID from list_documents. Optional when only one document is connected. |
comment_on_paragraph
Add a comment to a paragraph (anchored on its text).
| Parameter | Type | Description |
|---|---|---|
index * | integer | Zero-based paragraph index to comment on. |
text * | string | Comment text. |
documentId | string | Target document ID from list_documents. Optional when only one document is connected. |
get_tracked_changes
List tracked changes (revisions) in the document: type (insertion/deletion), author, date and a text snippet. Read-only; Office.js cannot create tracked changes.
| Parameter | Type | Description |
|---|---|---|
documentId | string | Target document ID from list_documents. Optional when only one document is connected. |
get_selection
Read the current user selection (cursor) in the document.
| Parameter | Type | Description |
|---|---|---|
documentId | string | Target document ID from list_documents. Optional when only one document is connected. |
save_document
Save the document. If it has never been saved, Word applies its default save behavior (may prompt).
| Parameter | Type | Description |
|---|---|---|
documentId | string | Target document ID from list_documents. Optional when only one document is connected. |
list_content_controls
List all content controls (template fields) in the document: id, title, tag, type, current text and placeholder. Use set_content_control_text with the id to fill them.
| Parameter | Type | Description |
|---|---|---|
documentId | string | Target document ID from list_documents. Optional when only one document is connected. |
tag | string | Only return content controls with this tag. |
title | string | Only return content controls with this title. |
set_content_control_text
Replace the text of a content control (template field) identified by its id from list_content_controls. Optionally update its title and tag.
| Parameter | Type | Description |
|---|---|---|
id * | integer | Content control id from list_content_controls. |
text * | string | New text for the content control. |
documentId | string | Target document ID from list_documents. Optional when only one document is connected. |
tag | string | New tag for the content control. |
title | string | New title for the content control. |
read_comments
Read all comments in the document body: id, author, text, resolved state, date, and replies. Note: adding replies is not supported by the current Word.js API set.
| Parameter | Type | Description |
|---|---|---|
documentId | string | Target document ID from list_documents. Optional when only one document is connected. |
get_document_properties
Read the document metadata: title, author, subject, keywords, comments, category, creation and last-save dates.
| Parameter | Type | Description |
|---|---|---|
documentId | string | Target document ID from list_documents. Optional when only one document is connected. |
set_document_properties
Set document metadata (title, author, subject, keywords, comments, category). Only provided fields are changed.
| Parameter | Type | Description |
|---|---|---|
author | string | Document author. |
category | string | Document category. |
comments | string | Document comments field. |
documentId | string | Target document ID from list_documents. Optional when only one document is connected. |
keywords | string | Document keywords. |
subject | string | Document subject. |
title | string | Document title. |
edit_table_columns
Add or delete columns of a table. Add: position "Before" inserts left of the first column, "After" right of the last column; optionally pre-fill with values (2D array, one column per entry). Delete: remove count columns starting at columnIndex (0-based). Note: some Word builds reject column operations with InvalidArgument.
| Parameter | Type | Description |
|---|---|---|
action * | string | Add or delete columns. |
tableIndex * | integer | Zero-based table index. |
columnIndex | integer | For delete: first column index to remove. |
count | integer | Number of columns (default 1). |
documentId | string | Target document ID from list_documents. Optional when only one document is connected. |
position | string | For add: "Before" inserts at the left edge, "After" at the right edge. |
values | array | For add: cell texts as 2D array (rows x added columns). |
set_table_cells
Set the text of multiple table cells in one call. Rows and columns are 0-based indices into the table.
| Parameter | Type | Description |
|---|---|---|
cells * | array | Cells to update. |
tableIndex * | integer | Zero-based table index. |
documentId | string | Target document ID from list_documents. Optional when only one document is connected. |
list_workbooks
Lists all Excel workbooks currently connected to the bridge server. Shows workbook IDs (file paths for saved files, generated IDs for unsaved) and connection status. Use this to find the workbookId to pass to other Excel tools when multiple workbooks are open.
execute_exceljs
Execute arbitrary Office.js code inside the live Excel workbook. The code runs inside Excel.run(async (context) => { ... }) with 'context' available as a variable. Use 'await context.sync()' after loading properties. Return a value to get it back as the tool result. Common operations: read/write ranges (workbook.worksheets), formulas, tables, charts. Cell references use A1 notation; values/formulas are returned as arrays matching the range shape.
| Parameter | Type | Description |
|---|---|---|
code * | string | Office.js code to execute. Runs inside Excel.run() with 'context' available. Use 'return' to send back a result. |
workbookId | string | Target workbook ID from list_workbooks. Optional when only one workbook is connected. |
inspect_workbook
Overview of the live workbook: all worksheets (name, position, visibility, used-range address), all Excel tables (name, sheet, range), all named ranges, and all PivotTables (name, sheet). Use this first to orient yourself in an unfamiliar workbook.
| Parameter | Type | Description |
|---|---|---|
workbookId | string | Target workbook ID from list_workbooks. Optional when only one workbook is connected. |
read_range
Read values, formulas and number formats from a range of the live workbook. Returns a 2D array (rows x columns) plus the range address and dimensions. Use "usedRange": true to read the whole used range of the sheet.
| Parameter | Type | Description |
|---|---|---|
includeFormulas | boolean | Include the formulas grid (default true). |
includeNumberFormat | boolean | Include the number-format grid (default false). |
range | string | A1 range address, e.g. "A1:C10" or "MyTable". Omit when usedRange is true. |
sheetName | string | Worksheet name. Defaults to the active worksheet. |
usedRange | boolean | Read the entire used range of the worksheet instead of a specific address. |
workbookId | string | Target workbook ID from list_workbooks. Optional when only one workbook is connected. |
write_range
Write values and/or formulas into a range of the live workbook. Accepts a 2D array (rows x columns) or a single scalar that fills the whole range. Formulas are set separately from values. Also supports setting the number format. Content in the target range is overwritten.
| Parameter | Type | Description |
|---|---|---|
range * | string | A1 range address, e.g. "A1:C10". |
formulas | 2D array of formula strings (e.g. "=SUM(A1:A10)"), or a single formula broadcast across the range. | |
numberFormat | Number format string (e.g. "0.00", "#,##0", "dd/mm/yyyy"), 2D array or single broadcast. | |
sheetName | string | Worksheet name. Defaults to the active worksheet. |
values | 2D array of values, or a single scalar broadcast across the range. | |
workbookId | string | Target workbook ID from list_workbooks. Optional when only one workbook is connected. |
format_range
Format a range: font (name, size, bold, italic, underline, color), fill color, borders (all/outline with style, weight, color), alignment, wrap, and number format. Only the provided properties are changed.
| Parameter | Type | Description |
|---|---|---|
range * | string | A1 range address, e.g. "A1:C10". |
bold | boolean | Bold text. |
borderColor | string | Border color as #RRGGBB. Default "#000000". |
borderStyle | string | Border line style. Default "Continuous". |
borders | string | Which borders to apply. "none" clears borders. |
fillColor | string | Cell fill color as #RRGGBB, e.g. "#FFFF00". |
fontColor | string | Font color as #RRGGBB, e.g. "#FF0000". |
fontName | string | Font family, e.g. "Calibri". |
fontSize | number | Font size in points. |
horizontalAlignment | string | |
italic | boolean | Italic text. |
numberFormat | string | Number format string, e.g. "0.00%". |
sheetName | string | Worksheet name. Defaults to the active worksheet. |
underline | string | Underline style. |
verticalAlignment | string | |
workbookId | string | Target workbook ID from list_workbooks. Optional when only one workbook is connected. |
wrapText | boolean | Wrap text within cells. |
set_dimensions
Set column widths and/or row heights for a range, in points. Optionally autofit columns or rows to their content.
| Parameter | Type | Description |
|---|---|---|
range * | string | A1 range address, e.g. "A:A" or "1:10" or "A1:C10". |
autofitColumns | boolean | Autofit column widths to content. |
autofitRows | boolean | Autofit row heights to content. |
columnWidth | number | Column width in points. |
rowHeight | number | Row height in points. |
sheetName | string | Worksheet name. Defaults to the active worksheet. |
workbookId | string | Target workbook ID from list_workbooks. Optional when only one workbook is connected. |
add_worksheet
Add a new worksheet to the workbook, optionally at a specific position, and activate it. Returns the new sheet name and position.
| Parameter | Type | Description |
|---|---|---|
name | string | Name for the new worksheet. Auto-generated when omitted. |
position | integer | Zero-based position to insert at. Default: append at end. |
workbookId | string | Target workbook ID from list_workbooks. Optional when only one workbook is connected. |
update_worksheet
Update an existing worksheet: rename it, move it to a position, change visibility, set the tab color, or activate it. Only provided properties are changed.
| Parameter | Type | Description |
|---|---|---|
sheetName * | string | Current name of the worksheet to update. |
activate | boolean | Make this the active worksheet. |
newName | string | New name for the worksheet. |
position | integer | Zero-based position to move the sheet to. |
tabColor | string | Tab color as #RRGGBB. Use "" to clear. |
visibility | string | Sheet visibility. |
workbookId | string | Target workbook ID from list_workbooks. Optional when only one workbook is connected. |
delete_worksheet
Delete a worksheet from the workbook. This removes its contents permanently and can break formulas referencing it.
| Parameter | Type | Description |
|---|---|---|
sheetName * | string | Name of the worksheet to delete. |
workbookId | string | Target workbook ID from list_workbooks. Optional when only one workbook is connected. |
sort_range
Sort a range by one or more columns. Fields are given as zero-based column offsets within the range.
| Parameter | Type | Description |
|---|---|---|
fields * | array | Sort fields, applied in order. |
range * | string | A1 range address to sort, e.g. "A2:D100" (include or exclude headers as needed). |
hasHeaders | boolean | True if the first row is a header row that should not be sorted. Default false. |
sheetName | string | Worksheet name. Defaults to the active worksheet. |
workbookId | string | Target workbook ID from list_workbooks. Optional when only one workbook is connected. |
find_in_range
Find text in a range or the whole used range. Returns the address of the first match, or all matches as a (possibly multi-area) address string.
| Parameter | Type | Description |
|---|---|---|
text * | string | Text to find. |
all | boolean | Return all matches instead of only the first. Default true. |
completeMatch | boolean | Match the entire cell contents. Default false. |
matchCase | boolean | Case-sensitive search. Default false. |
range | string | A1 range address to search. Defaults to the used range. |
sheetName | string | Worksheet name. Defaults to the active worksheet. |
workbookId | string | Target workbook ID from list_workbooks. Optional when only one workbook is connected. |
add_table
Create an Excel table (ListObject) over a range. Returns the table name and range.
| Parameter | Type | Description |
|---|---|---|
range * | string | A1 range address including headers, e.g. "A1:D20". |
hasHeaders | boolean | True if the first row contains headers. Default true. |
name | string | Table name. Auto-generated when omitted. |
sheetName | string | Worksheet name. Defaults to the active worksheet. |
style | string | Built-in table style name, e.g. "TableStyleMedium2". |
workbookId | string | Target workbook ID from list_workbooks. Optional when only one workbook is connected. |
add_chart
Create a chart from a range. Chart types: ColumnClustered, ColumnStacked, BarClustered, BarStacked, Line, LineMarkers, Pie, Doughnut, Area, XYScatterLines. Returns the chart name and title.
| Parameter | Type | Description |
|---|---|---|
range * | string | A1 range address with the data (and labels) to plot. |
chartType | string | Chart type. Default ColumnClustered. |
sheetName | string | Worksheet name. Defaults to the active worksheet. |
title | string | Chart title. Empty string removes the title. |
workbookId | string | Target workbook ID from list_workbooks. Optional when only one workbook is connected. |
add_conditional_format
Add a conditional formatting rule to a range. Supports cellValue (compare with a formula and fill on match), colorScale (min/max gradient), dataBar, and iconSet rules.
| Parameter | Type | Description |
|---|---|---|
range * | string | A1 range address. |
ruleType * | string | Type of rule. |
fillColor | string | cellValue: fill color on match, as #RRGGBB. Default "#FFC7CE". |
formula1 | string | cellValue: comparison value/formula, e.g. "0" or "=TODAY()". |
formula2 | string | cellValue: second bound for Between/NotBetween. |
iconSetStyle | string | iconSet: icon set style. Default ThreeTrafficLights1. |
maxColor | string | colorScale: maximum color. Default "#63BE7B". |
minColor | string | colorScale: minimum color. Default "#F8696B". |
operator | string | cellValue: comparison operator. |
sheetName | string | Worksheet name. Defaults to the active worksheet. |
workbookId | string | Target workbook ID from list_workbooks. Optional when only one workbook is connected. |
add_name
Define a named range (named formula) in the workbook, e.g. name "TaxRate" for "=Sheet1!$B$1".
| Parameter | Type | Description |
|---|---|---|
name * | string | Name to define, e.g. "TaxRate". |
ref * | string | Reference formula, e.g. "=Sheet1!$A$1:$D$10". |
comment | string | Optional description. |
workbookId | string | Target workbook ID from list_workbooks. Optional when only one workbook is connected. |
set_data_validation
Set a data validation rule on a range. Supports list, wholeNumber, decimal, textLength, and date rules.
| Parameter | Type | Description |
|---|---|---|
range * | string | A1 range address. |
type * | string | Validation type. |
allowBlank | boolean | Allow blank cells. Default true. |
formula1 | string | Numeric/date/textLength: bound value or formula. |
formula2 | string | Second bound for Between/NotBetween. |
list | string | List type: comma-separated values, e.g. "Low,Medium,High". |
operator | string | Numeric/date/textLength: comparison operator. |
sheetName | string | Worksheet name. Defaults to the active worksheet. |
workbookId | string | Target workbook ID from list_workbooks. Optional when only one workbook is connected. |
calculate_workbook
Force Excel to recalculate the workbook. Use after writes when you need formula results to be current before reading them back.
| Parameter | Type | Description |
|---|---|---|
type | string | Recalculation type. Default "Recalculate". |
workbookId | string | Target workbook ID from list_workbooks. Optional when only one workbook is connected. |
insert_or_delete_range
Insert or delete a range, shifting existing cells. For insert, shift is Down or Right; for delete, Up or Left.
| Parameter | Type | Description |
|---|---|---|
action * | string | Whether to insert or delete. |
range * | string | A1 range address to insert at or delete. |
sheetName | string | Worksheet name. Defaults to the active worksheet. |
shift | string | Shift direction. Defaults: insert=Down, delete=Up. |
workbookId | string | Target workbook ID from list_workbooks. Optional when only one workbook is connected. |
set_merge
Merge or unmerge cells in a range.
| Parameter | Type | Description |
|---|---|---|
action * | string | Whether to merge or unmerge. |
range * | string | A1 range address. |
across | boolean | merge: merge each row separately instead of one area. Default false. |
sheetName | string | Worksheet name. Defaults to the active worksheet. |
workbookId | string | Target workbook ID from list_workbooks. Optional when only one workbook is connected. |
autofit_range
Autofit column widths and/or row heights of a range to their content.
| Parameter | Type | Description |
|---|---|---|
range * | string | A1 range address, e.g. "A:F". |
columns | boolean | Autofit column widths. Default true. |
rows | boolean | Autofit row heights. Default true. |
sheetName | string | Worksheet name. Defaults to the active worksheet. |
workbookId | string | Target workbook ID from list_workbooks. Optional when only one workbook is connected. |
add_comment
Add a threaded comment to a cell.
| Parameter | Type | Description |
|---|---|---|
cellAddress * | string | Cell reference including sheet, e.g. "Sheet1!A1". |
text * | string | Comment text. |
workbookId | string | Target workbook ID from list_workbooks. Optional when only one workbook is connected. |
refresh_pivottables
Refresh all PivotTables in the workbook. Use after data changes when pivot summaries must be current.
| Parameter | Type | Description |
|---|---|---|
workbookId | string | Target workbook ID from list_workbooks. Optional when only one workbook is connected. |
set_worksheet_protection
Protect or unprotect a worksheet. Protection restricts user edits; cells formatted as locked are affected.
| Parameter | Type | Description |
|---|---|---|
protect * | boolean | True to protect, false to unprotect. |
sheetName * | string | Worksheet name. |
password | string | Optional password for the protection. |
workbookId | string | Target workbook ID from list_workbooks. Optional when only one workbook is connected. |
read_threaded_comments
Read all threaded comments in the workbook: content, author, creation date, resolved state, and replies. Use reply_to_comment or resolve_comment with a comment id from this output.
| Parameter | Type | Description |
|---|---|---|
workbookId | string | Target workbook ID from list_workbooks. Optional when only one workbook is connected. |
reply_to_comment
Add a reply to an existing threaded comment. Use the comment id from read_comments.
| Parameter | Type | Description |
|---|---|---|
commentId * | string | Comment id from read_comments. |
text * | string | Reply text. |
workbookId | string | Target workbook ID from list_workbooks. Optional when only one workbook is connected. |
resolve_comment
Resolve or reopen a threaded comment. Use the comment id from read_comments.
| Parameter | Type | Description |
|---|---|---|
commentId * | string | Comment id from read_comments. |
resolved * | boolean | True to resolve, false to reopen. |
workbookId | string | Target workbook ID from list_workbooks. Optional when only one workbook is connected. |
set_hyperlink
Set a hyperlink on a cell (address, display text, tooltip). The cell text is replaced by textToDisplay when provided. Pass address as null to remove the hyperlink.
| Parameter | Type | Description |
|---|---|---|
address * | string | null | Target URL, e.g. "https://example.com". Pass null to remove the hyperlink. |
cellAddress * | string | Sheet-qualified cell reference, e.g. "Sheet1!B2". |
textToDisplay | string | Cell text shown for the link. Defaults to the address. |
tooltip | string | Screen tip shown on hover. |
workbookId | string | Target workbook ID from list_workbooks. Optional when only one workbook is connected. |
freeze_panes
Freeze rows and columns of a worksheet at a cell (everything above and left of the cell stays visible), or unfreeze. E.g. freezeAt "A2" freezes the first row, "B2" freezes row 1 and column A.
| Parameter | Type | Description |
|---|---|---|
freezeAt * | string | null | Cell reference to freeze at, e.g. "A2". Pass null to unfreeze. |
sheetName * | string | Worksheet name. |
workbookId | string | Target workbook ID from list_workbooks. Optional when only one workbook is connected. |
replace_in_sheet
Find and replace text across a whole worksheet (substring match per cell by default). Returns the number of cells changed. Uses findAll so merged/hidden cells behave like the Excel UI.
| Parameter | Type | Description |
|---|---|---|
find * | string | Text to find. |
replace * | string | Replacement text. |
completeMatch | boolean | Match the entire cell contents. Default false. |
matchCase | boolean | Case-sensitive search. Default false. |
sheetName | string | Worksheet name. Defaults to the active worksheet. |
workbookId | string | Target workbook ID from list_workbooks. Optional when only one workbook is connected. |
clear_range
Clear the contents and formatting of a range in the live workbook.
| Parameter | Type | Description |
|---|---|---|
range * | string | A1 range address, e.g. "A1:C10". |
sheetName | string | Worksheet name. Defaults to the active worksheet. |
workbookId | string | Target workbook ID from list_workbooks. Optional when only one workbook is connected. |
copy_range
Copy a source range to a target range in the live workbook. Copies values, formulas and formatting by default; valuesOnly copies just the results.
| Parameter | Type | Description |
|---|---|---|
source * | string | A1 range address to copy from, e.g. "A1:C3". |
target * | string | A1 range address (top-left corner) to copy into, e.g. "E1". |
sheetName | string | Worksheet name for both ranges. Defaults to the active worksheet. |
valuesOnly | boolean | Copy only the calculated values, not formulas or formatting. |
workbookId | string | Target workbook ID from list_workbooks. Optional when only one workbook is connected. |