---
name: reducto-office
description: Edit a Word (.docx), PowerPoint (.pptx) or Excel (.xlsx) file through the Reducto Office MCP server. Use when a task needs to read, edit, redline, fill or restyle one with JavaScript against a live file, optionally while a person watches in a browser.
---

# Reducto Office

MCP tools: `create_file`, `exec`, `open`, `list_files`, `rename_file` and `delete_files`. Everything else is HTTP against
the URLs they return.

## A link from a person

When a person gives you a link (`…/d/<id>`), call `open({ link })` and use its `fileId`
with `exec`. Its `role` says whether you may edit. `list_files` lists the person's files; `delete_files` deletes ones they own and asked you to delete.
The server is `/mcp/app`; the person signs in with their Reducto account once.

## Workflow

1. `create_file({ agent, name?, kind?, blank? })` → `{ fileId, uploadUrl, appUrl, downloadUrl, documentUrl, pdfUrl, assetsUrl }`.
   `kind` is `"docx"` (default), `"pptx"` or `"xlsx"`; `blank: true` starts from an empty file.
   `agent` is your name, e.g. `"claude-code"` or `"cursor (Jordan)"`. Use the same name on
   every call. People watching see it on each step, and tracked changes and comments carry it.
2. `PUT <uploadUrl>` with the raw file bytes (40MB max). A Word 97-2003 .doc or a PDF is
   converted to .docx on upload; a PDF's layout is rebuilt, so check it before you edit. The server loads the document as soon as the upload lands, so the first
   exec is immediate.
3. If a person is following along (desktop or IDE client, a chat with a user), open `appUrl`
   in their browser, or send it and ask them to open it. They see every exec land live and can
   edit in the same document. Skip this in fully unattended runs; everything runs headless.
4. `exec({ agent, fileId, intent, code })` as many times as needed. `intent` is a few words on
   what the call does ("Add a summary table", "Check page 2"); people watching read it in place of
   the code. Every exec that changes the document saves it. One step per exec when steps are
   independent, so a failure in one leaves the others intact and reported.
5. `export({ fileId })` returns signed links to the current bytes (`url`) and, for a Word file,
   the PDF (`pdfUrl`). Fetch them with `curl -fsS -o <path> '<url>'`; each link reads one file
   and expires in 15 minutes, so call `export` again later. `documentUrl` and `pdfUrl` from
   `create_file` work only with the person's sign-in.

## Without MCP

A file id or a `/d/<id>` link is enough; the same calls are plain HTTP on this host.
`GET /f/<id>` lists them with this file's state. `POST /f/<id>/exec` takes JSON
`{"code": "...", "agent": "<your name>", "intent": "..."}` (or the name in an `X-Clippy-Agent` header) and
returns `{ ok, content, renders, version, notice?, error?, hint? }`; renders come back as image
content and as `renders[].url`. An exec without a name is refused. Send the same header on
`PUT` to `uploadUrl` or `assetsUrl` to put your name on the upload.

## PowerPoint and Excel

A `.pptx` or `.xlsx` file binds `presentation` (a PowerPointPresentation) or `workbook` (an
ExcelWorkbook) in place of `doc`. They follow the Office.js object model without `run`/`sync`/`load`:
`presentation.slides.items`, `workbook.worksheets.getItem("Sheet1").getRange("A1:B2").values = …`.
Recipes and readers: [reference/pptx.md](https://clippy.reducto.ai/skill/reference/pptx.md) and [reference/xlsx.md](https://clippy.reducto.ai/skill/reference/xlsx.md).
Read the one for the file's kind before the first exec; the rest of this page is about Word.
A blank deck has no slides: add one from a layout first, e.g.
`presentation.slides.add({ layoutId: presentation.slideMasters.getItemAt(0).getLayoutByName("Title and Content").id })`.
`renderPage(n)` paints slide n and `renderRange(sheet, range)` paints cells; each PNG also lands in `renders`.
For a new deck with no design of its own, `kits.corporate(brand?)` in exec builds consulting-style
slides (claim titles, one accent, grey panels, fixed anatomy); see "Corporate kit" in reference/pptx.md.

## exec

`code` is an async module body: top-level `await` works, `require`/`import` do not. Pre-bound:

- `doc` — the live WordDocument. Edits apply at once; there is nothing to open or save.
- `readPage(spec?)` — layout sketch text; no argument gives a one-line index of every page,
  `"2"`, `"1-3"` or `[1, 4]` full sketches. Works headless.
- `renderPage(n)` — PNG of page n, returned as image content plus a URL. Works headless.
- `text(value)`, `image(bytes)`, `console.log(...)` — attach output. The return value prints too.
- `state` — a plain object kept between execs. Store text or indices, never handles.
- `fs` — async workspace files: `await fs.readFile(path)` → Uint8Array,
  `fs.readFile(path, "utf8" | "base64")`, `fs.writeFile`, `fs.readdir`, `fs.exists`.
  Uploaded assets live in `/workspace/uploads`.
- `bash(cmd)` — sandbox shell, cwd `/workspace`; the workspace holds no source to grep.
- `api` — the facade's own reference: `api.search("table border width")` ranks members by
  what they do; `api.describe("Table")`, `api.describe("Table.getBorder")` or
  `api.describe(handle)` lists signatures, enum values and option shapes. Call it before
  guessing a name the reference does not show.
- `docx` — the facade namespace (enums such as `docx.ContentControlType`).

Rules:

- Collections (paragraphs, tables, rows, cells, search hits) are not arrays: `.items`,
  `.length`, `for…of`. Items are rebuilt on every access, so address them by index or text,
  never by identity.
- Unknown option names throw. Trust the error text.
- `doc.getSelection()` is unavailable in this server.

Full API recipes (find/replace, tables, formatting, headers/footers, content controls,
tracked changes, floating shapes, pictures): [reference/facade.md](https://clippy.reducto.ai/skill/reference/facade.md).
Read it before the first edit; copy its recipes rather than guessing method names.

## Pictures and other files

Never base64 a file into `code`. Upload it once, then read it from the workspace:

```
PUT <assetsUrl>logo.png        (raw bytes; any Content-Type; 20MB max)
→ { "ok": true, "path": "/workspace/uploads/logo.png", "size": 12345 }
```

```js
const b64 = await fs.readFile("uploads/logo.png", "base64");
const p = doc.body.paragraphs.items[0];
p.insertInlinePictureFromBase64(b64, "End", { width: 120 });        // inline, in the text flow
p.insertPictureFromBase64(b64, { height: 40, left: 306, top: 445,  // floating, page coordinates
  relativeFromH: "page", relativeFromV: "page", wrap: "None", altText: "Logo" });
```

`GET <assetsUrl>` lists uploaded assets; the same name PUT twice overwrites. Assets survive
server restarts and appear in the browser sidebar like any other upload. `assetsUrl` carries
its own credential, so a shell needs no sign-in; it reaches this file's assets only and
expires in 15 minutes. `open({ link })` returns a fresh one.

## Concurrency

A person in the tab and other agents can edit the same file, even while your exec runs.
Edits merge character by character: an exec starts from everyone's latest text, and what it
changed is merged with what others typed meanwhile. When someone else changed the document
since your last exec, the result starts with a `Note:` line (`notice` over REST) that names
them. Then re-read (`doc.search`, `readPage`) before you edit text you saw earlier.

## Verify, then stop

Verify once: a search for a text spot check, `renderPage` or `readPage` when layout
or formatting changed. Counts returned by `replaceAll` and errors thrown by failed anchors
already count as verification.
