Skip to main content
Glama

execute_custom_code

Run custom Python and pandas code on Excel workbooks or sheets to perform tailored data analysis, transformations, and retrieve results.

Instructions

Execute sandboxed Python/pandas code against a workbook or sheet and return result.

Args: file_path: Path to source workbook to load into the sandbox. code: Python code string. Sandbox exposes df (pandas.DataFrame), pd (pandas), np (numpy). sheet: Optional sheet name to load into df. If omitted, the first sheet or a default is used. output_file: Optional path to write results back to a workbook.

Returns: dict: Execution result, typically containing result (from user code), stdout and errors.

Raises: ValueError: If code fails safety checks in the sandbox.

Notes: - High-risk: sandbox uses AST checks — document the allowed AST nodes and forbidden names. - Recommend returning a short example snippet of a safe operation in the route docs.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
codeYes
sheetNo
file_pathYes
output_fileNo
Behavior3/5

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

With no annotations, the description discloses sandboxing, AST safety checks, ValueError, and return structure, but the note about allowed AST nodes is a directive to document rather than an actual disclosure, leaving important safety details unknown.

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?

The description is well-structured with clear sections and a front-loaded summary, but the final note about recommending examples is meta-documentation that does not directly help the agent.

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?

The description covers inputs, outputs, and errors, but for a high-risk tool it omits the actual allowed AST nodes, forbidden names, and any example, leaving critical execution constraints unspecified.

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

Parameters5/5

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

All four parameters receive meaningful semantic explanations beyond the schema: code execution context (df, pd, np), sheet fallback behavior, and output_file purpose, fully compensating for the 0% schema description coverage.

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?

The opening sentence clearly states a specific verb ('Execute') with a resource ('workbook or sheet') and environment ('sandboxed Python/pandas'), making it unmistakable and distinct from the many specialized sibling tools.

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?

The description implies this is for arbitrary custom code, but it does not explicitly state when to use it versus the specialized sibling tools, nor does it mention any exclusions or alternatives.

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

Install Server

Other Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/mbeps/excel-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server