Skip to main content
Glama

execute_exceljs

Run Office.js code directly in an open Excel workbook to read or write ranges, formulas, tables, and charts, enabling live data access and edits through a single execution call.

Instructions

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.

Input Schema

NameRequiredDescriptionDefault
codeYesOffice.js code to execute. Runs inside Excel.run() with 'context' available. Use 'return' to send back a result.
workbookIdNoTarget workbook ID from list_workbooks. Optional when only one workbook is connected.

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.6.0

TDQS

B3.4/5.0
Behavior3/5

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

With no annotations, the description carries the full burden, and it does disclose the execution wrapper shape, the required context.sync() step, and how results are returned. It omits behavior that matters for arbitrary live-workbook code: error/exception handling, whether mutations persist or are undoable, timeouts, and any risk warning.

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?

Four sentences, front-loaded with the action and the execution contract, and the operations list is compact. The return-value and context.sync notes overlap slightly with the schema's own description, but no sentence is wasted.

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 definition covers the execution contract and return handling adequately. It falls short on failure modes, persistence of mutations, and result serialization limits, which an agent needs before running write-side code against a live workbook.

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 coverage is 100% and both parameters are documented in the schema, so the baseline is 3. The description adds useful semantics beyond the schema (A1 notation, values/formulas returned as arrays matching range shape) but says nothing additional about workbookId beyond what the schema already states.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

States a specific verb+resource: executes arbitrary Office.js inside the live Excel workbook, which clearly differentiates it from the many declarative Excel CRUD siblings (read_range, write_range, format_range). It does not explicitly distinguish itself from the sibling execute_officejs, leaving the agent to infer Excel-vs-Office from the name.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

Usage is only implied: 'arbitrary code' plus a list of 'common operations' suggests this is the escape hatch when the declarative tools fall short, but the description never says so, nor does it say when to prefer read_range/write_range/add_chart instead. Only the mechanical when ('await context.sync() after loading properties') is explicit.

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