Edit Excel cells, Word text or PDF pages
office_editUse this when the user asks to change an Excel workbook (.xlsx, .xlsm) , a Word document (.docx, .docm) or a PDF in an approved project, without Office or another program. Workbook: values (rows of cells) are written from the range's top-left cell; formulas recalculate when the file is next opened in Excel. Document: oldText is replaced by newText inside paragraphs of the body, headers, footers and notes, across formatting runs, only when it occurs exactly expectedReplacements times (default 1); the new text takes the formatting where the match starts. PDF: operations delete pages or insert pages laid out from markdown or copied from another PDF in the project, in order. A deleted page leaves the file with its content and bookmarks; deleting also removes the accessibility tags (tagsRemoved). Pages with form fields cannot be deleted or copied; a signed or encrypted PDF is refused. Everything else in the file stays as it was. Changes files on the computer. Needs the sessionId from execution_session_open and a new operationId; each call is metered as one execution. A short result is returned inline within about two seconds; otherwise keep the returned IDs for operation_status and operation_output and do not resend the call.
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"sessionId": "<sessionId>",
"operationId": "<operationId>",
"path": "<path>"
},
"name": "office_edit"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| path | Yes | Workbook (.xlsx, .xlsm), document (.docx, .docm) or PDF (.pdf) path relative to the selected project root (or the workspace root) | |
| range | No | Workbooks (required): top-left cell (C3), a range matching the values' size (C3:E5), or with a sheet (Sheet1!C3) | |
| sheet | No | Workbooks: sheet name or 0-based index (default: the first sheet, or the sheet named in range) | |
| values | No | Workbooks (required): rows of cells, text, a number, true/false, null (empty) or {formula: "=A1*2"}, up to 1 MiB as JSON | |
| newText | No | Documents (required): replacement text (may be empty) | |
| oldText | No | Documents (required): exact text to find inside one paragraph (tabs and line breaks allowed) | |
| sessionId | Yes | executionSessionId returned by execution_session_open | |
| deadlineAt | No | Optional UTC admission deadline at most 60 seconds ahead (queue start timeout, NOT process execution lifetime) | |
| operations | No | PDFs (required): 1-100 steps applied in order, page numbers from 1 as the document stands after the steps before: {type: "delete", pages: [2, 3]} or {type: "insert", at: 1 (before page 1; page count + 1 appends), markdown} or {type: "insert", at, sourcePath (another PDF in the project), sourcePages? (default all)} | |
| operationId | Yes | A new random UUID v4 for this call; reuse it only to retry this same call | |
| expectedSha256 | No | SHA-256 of the current file; the edit is refused if the file changed (recommended, from office_read) | |
| idempotencyKey | No | Optional retry key, 8-128 chars of [A-Za-z0-9._:-]; defaults to operationId | |
| efficiencyProfile | No | Optional, unverified label of the client's model, recorded as display metadata in the device owner's local activity statistics. Omit when unknown. Never send credentials or conversation content. | |
| expectedReplacements | No | Documents: how many times oldText must occur; all are replaced (default 1) |