Skip to main content
Glama

yade_execute_code

Execute Python code in the YADE process to control discrete element simulations, query body states, and modify engines or materials with immediate feedback.

Instructions

Execute Python code synchronously in the running YADE process.

Returns stdout immediately. Code runs in the YADE Python environment where yade modules are already imported; side effects persist.

Typical uses:

  • Query simulation state: O.bodies count, current iteration

  • Create/modify bodies, engines, interactions

  • Read or set material properties

  • Development and REPL-style testing

Unlike yade_execute_task, this tool is fire-and-return: the response contains the full output. It is NOT tracked by yade_list_tasks and cannot be interrupted or polled.

WARNING: Avoid long-running calls (O.run with many iterations, heavy loops). They block until completion or timeout and cannot be cancelled. Use yade_execute_task for long simulations.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
codeYesPython code to execute in YADE process
timeoutNoConsole execution timeout in seconds

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Behavior5/5

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

No annotations provided, so description carries full burden. Discloses critical behavioral traits: synchronous/blocking execution ('fire-and-return'), stdout return mechanism, side effect persistence ('side effects persist'), environment context ('yade modules are already imported'), and operational constraints ('cannot be cancelled'). Warning section highlights timeout risks.

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?

Exceptionally well-structured with clear sections: execution model, return behavior, typical uses, sibling differentiation, and warning. Every sentence earns its place. Front-loaded with synchronous nature and immediate return. No redundancy or filler.

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 output schema exists (per context signals), description appropriately minimizes return value explanation while noting 'Returns stdout immediately'. Comprehensive coverage of execution environment, blocking behavior, and sibling relationships sufficient for a code execution tool with complex side effects.

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 description coverage is 100%, establishing baseline 3. Schema already documents 'Python code to execute in YADE process' and timeout details. Description provides usage examples (querying O.bodies) that contextualize the code parameter but does not add syntactic or semantic details beyond the schema definitions.

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?

Opens with specific verb+resource ('Execute Python code synchronously in the running YADE process') and explicitly distinguishes from sibling yade_execute_task by contrasting 'fire-and-return' vs tracked/async execution models. Lists concrete operations (query simulation state, create bodies, set properties) that clarify scope.

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?

Explicitly names alternative tool (yade_execute_task) for long simulations and states when NOT to use this tool ('Avoid long-running calls... They block until completion'). Clearly states limitations: 'NOT tracked by yade_list_tasks', 'cannot be interrupted or polled'. Typical uses section provides positive guidance.

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/yusong652/yade-mcp'

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