Skip to main content
Glama
whats2000

Isaac Sim MCP Server

execute_script

Run arbitrary Python code in Isaac Sim for operations not covered by named tools, such as creating Action Graphs, computing IK, or configuring advanced USD properties. Use for custom simulation logic and callbacks.

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 for: operations no named tool covers, such as creating Action Graphs, computing IK, setting up physics callbacks, or configuring advanced USD properties.

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.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
cwdNo
codeYes

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.1.0

TDQS

A5/5.0
Behavior5/5

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

With no annotations, the description carries full responsibility for disclosing side effects. It explicitly warns that touching an articulation controlled by a running ScriptNode/Action Graph can silently break its control path, that read-only diagnostics are safe, and that stop_simulation should be used before writes. This is strong, actionable risk disclosure.

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 detailed but every block earns its place: purpose, routing, caution, escalation path, and parameter semantics. The structure uses clear labels and scannable lists, and the front-loaded 'Escape hatch' phrase immediately conveys the tool's nature.

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?

Given the tool's arbitrary-code natureaint and the existing output schema, the description covers everything an agent needs: when to use it, when not to, safety hazards, the stopping prerequisite, and the alternative for persistent code. No critical context appears missing.

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?

Schema description coverage is 0%, so the description alone carries parameter meaning. It explains that 'code' is Python code executed in the Isaac Sim context and that 'cwd' is an optional working directory added to sys.path. This goes well beyond the raw schema fields.

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 description opens with 'Escape hatch: execute arbitrary Python code in Isaac Sim,' using a specific verb and resource. It clearly distinguishes itself from named sibling tools by listing what those tools handle and framing this as the fallback for uncovered operations.

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?

The description gives explicit 'PREFER named tools over this' and 'USE this for' sections, naming specific alternatives like set_joint_positions, get_prim_info, and step_simulation. It also provides a concrete boundary: use reload_script for persistent controllers over 20 lines.

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