Skip to main content
Glama

execute_script

Execute arbitrary Python code in Isaac Sim for operations not covered by named tools. Stop a running simulation before modifying articulations; read-only diagnostics remain safe.

Instructions

Escape hatch: execute arbitrary Python code in Isaac Sim.

PREFER named tools over this for: reading/setting joints (set_joint_positions, get_joint_positions), inspecting state (get_prim_info, get_physics_state, get_joint_config), stepping simulation (step_simulation), and checking logs (get_isaac_logs).

USE this only for a trusted operation that no named tool covers. Execution is policy-gated, cooperatively timed, output-bounded, cwd-restricted, and audited by code hash. Background scheduling is denied unless both the request and administrator policy explicitly opt in.

CAUTION: touching an articulation controlled by a running ScriptNode / Action Graph can silently break its control path (no error is raised). While a graph is running, read-only diagnostics (get_prim_info, get_physics_state, get_joint_positions, get_isaac_logs) are safe, but stop_simulation before using execute_script or named write tools on the same articulation.

For persistent controllers (>20 lines), write a .py file and load it with reload_script instead of pasting code here.

Args: code: Python code to execute in the Isaac Sim context. cwd: Optional working directory to add to sys.path before execution. timeout_s: Cooperative Python deadline; capped by extension policy. max_output_bytes: Combined per-stream capture limit; capped by policy. allow_background: Request background scheduling. Default false and rejected unless the extension policy also enables it.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
cwdNo
codeYes
timeout_sNo
command_idNo
idempotency_keyNo
allow_backgroundNo
max_output_bytesNo

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes
Install Server

TDQS

A4.9/5.0
Behavior5/5

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

No annotations are provided, so the description carries the full behavioral burden, and it does so thoroughly: policy-gated execution, cooperative timing, output bounding, cwd restriction, code-hash auditing, and background scheduling denial. It also warns about the silent control-path breakage risk for ScriptNode/Action Graph articulations and identifies which diagnostics remain safe.

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?

The description is front-loaded with the core escape-hatch purpose and preferred alternatives, then moves to constraints, hazard warnings, and persistent-controller guidance. The Args section is telegraphic and directly maps to the schema. Every sentence earns its place despite the length.

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

Completeness5/5

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

For a powerful, risky arbitrary-code tool with no annotations, this is remarkably complete: it covers policy restrictions, runtime limits, safety hazards, alternatives, and the background scheduling edge case. An output schema exists, so not explaining return values is acceptable. The only minor omission is command_id/idempotency_key semantics, which is small relative to overall completeness.

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?

Schema description coverage is 0%, so the description must compensate, and it does for most parameters: code, cwd with sys.path behavior, timeout_s as a cooperative capped deadline, max_output_bytes as a per-stream capture limit, and allow_background with default/policy behavior. However, command_id and idempotency_key are not described; their names imply purpose but leave semantics to inference.

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 states a specific action and resource: 'execute arbitrary Python code in Isaac Sim' and labels itself an 'Escape hatch.' It explicitly lists what it is not for by naming preferred sibling tools (set_joint_positions, get_prim_info, step_simulation, get_isaac_logs), making its purpose and scope unmistakable.

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

Usage Guidelines5/5

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

Gives explicit when-to-use and when-not-to-use guidance: prefer named tools for joints, state inspection, stepping, and logs; use only when no named tool covers the operation. It also tells agents to use reload_script for persistent controllers and to stop_simulation before touching articulations with running graphs.

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

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/Tim0320/IsaacSim-MCP'

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