Skip to main content
Glama

execute_officejs

Run Office.js code inside an open PowerPoint presentation to add shapes, edit text, change formatting, and manage slides in place while preserving the current view.

Instructions

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 formatting-only changes (to read a shape's text in place, load shape.textFrame with hasText + textRange).

Input Schema

NameRequiredDescriptionDefault
codeYesOffice.js code to execute. Runs inside PowerPoint.run() with 'context' available. Use 'return' to send back a result.
presentationIdNoTarget presentation ID from list_presentations. Optional when only one presentation is connected.

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.6.0

TDQS

A4/5.0
Behavior4/5

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

With no annotations, the description carries the full burden and does substantial work: it explains the execution wrapper (PowerPoint.run with 'context'), the required await context.sync() pattern, that a returned value comes back as the tool result, that values are in points (1/72 inch), and that edits apply in place preserving the current view. It omits failure behavior — how errors/exceptions surface, whether partial edits persist, and any timeout or sandbox limits — which matters for arbitrary code execution.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Purpose is front-loaded in the first clause, and the alternative-tool routing appears before the API details. Dense with useful content, though the final sentence stacks the view-preservation rationale, the sibling preference, and a parenthetical API hint, which could be split for cleaner scanning.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For an arbitrary-code-execution tool with no annotations and no output schema, the description covers execution context, sync, return values, units, and view preservation — enough to attempt a call. What's missing is the risk/error surface: whether thrown errors are returned as text, whether edits are reversible, and whether re-running is safe. That gap is significant for a tool that can mutate a live deck.

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

Parameters3/5

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

Schema description coverage is 100%, so both `code` and `presentationId` are already documented, including the PowerPoint.run wrapper and the return convention — the description mostly restates this. The points-unit note adds genuine meaning about how values inside the code are interpreted, but it is not tied to either parameter. Baseline 3 is appropriate given the schema does the parameter work.

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?

States a specific verb and resource — 'Execute arbitrary Office.js code inside the live PowerPoint presentation' — and immediately names the siblings it displaces (edit_shape_paragraphs / edit_slide_xml). An agent can distinguish this general escape hatch from the specialized edit tools without opening any schema.

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?

Explicitly directs: 'prefer this over edit_shape_paragraphs / edit_slide_xml for text-only or formatting-only changes', which gives a concrete selection criterion against named alternatives. It also lists common operations to signal fit. It stops short of saying when NOT to use arbitrary code (e.g., prefer a dedicated tool for routine ops or when you don't know the API).

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