Skip to main content
Glama
Knight60
by Knight60

execute_arcpy_code

Execute custom Python code in ArcGIS Pro using arcpy for tasks not covered by predefined tools, such as managing layers, querying attributes, or exporting results.

Instructions

Execute arbitrary Python code inside ArcGIS Pro (arcpy is pre-imported; use arcpy.mp.ArcGISProject('CURRENT') for the open project). Use print() to return output. Use this when no dedicated tool covers the task.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
codeYes

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes
Behavior2/5

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

No annotations provided, so description must disclose behavioral traits. It mentions arcpy pre-imported and print() for output, but does not address error behavior, side effects, security restrictions, or limits. Incomplete.

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

Conciseness5/5

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

Two sentences, front-loaded with core functionality and context, no filler. Every sentence adds value.

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

Completeness4/5

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

For a code execution tool with one parameter and an output schema, description covers the essential context: pre-imported arcpy, project access hint, and output method. Could mention error handling but sufficient.

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

Parameters4/5

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

Single parameter 'code' is well-described: it is arbitrary Python code, arcpy is pre-imported, and output is via print(). Schema coverage 0% so description compensates well, though lacks constraints or examples.

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?

Description explicitly states the tool executes arbitrary Python code in ArcGIS Pro with arcpy pre-imported, and distinguishes from siblings by saying 'use this when no dedicated tool covers the task.'

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?

Provides clear guidance to use when no dedicated tool exists, and includes a specific hint about accessing the current project. Lacks explicit 'when not to use' but context is sufficient.

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/Knight60/ArcGIS-MCP'

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