Skip to main content
Glama

femm_run_script

Run multi-line MicroPython scripts with FEMM commands as globals, either in the current session to modify its model or in batch mode as a separate engine.

Instructions

Run a multi-line MicroPython script with FEMM's commands as globals (mi_addnode(...) etc., no femm. prefix). Give code or path (.py). mode=inprocess (default): written to <work_dir>/scripts and executed inside this session's engine with exec(open(p).read()) (VERIFIED on FEMM 5): it sees and changes the session's model; set a global result (or result_var) to return a value; print() output is NOT captured (the engine's stdout is discarded). mode=batch: runs femm_headless --port <free> -run script.py args... as a separate engine (fresh state, exits at the end); returns stdout, stderr and exit code (1 on a script error, with the message in stderr). Use for long independent jobs or sys.argv-driven scripts.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
argsNo
codeNo
modeNoinprocess
pathNo
sessionNomain
timeoutNo
result_varNoresult

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.1.0

TDQS

A4.3/5.0
Behavior5/5

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

With no annotations, the description carries the full burden and delivers: it discloses that inprocess mutates the live session model, that print() output is discarded (engine stdout not captured), the result/result_var return mechanism, that batch uses fresh state and exits, and that batch returns stdout/stderr/exit code with code 1 on script error. These are exactly the non-obvious behavioral facts an agent needs.

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?

Front-loads purpose, then structures mode behavior as labelled blocks (mode=inprocess / mode=batch). Dense but nearly every sentence carries information; the parenthetical 'VERIFIED on FEMM 5' is the only slightly editorial aside.

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 7-parameter tool with no annotations and no output schema, the description is substantially complete: it explains both execution modes, the return-value channel, and stdout behavior. The remaining omissions (session, timeout semantics) are modest but keep it short of full coverage.

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 0% across 7 params, so the description must compensate. It substantively covers code, path, mode, and result_var/result, and hints at args via 'sys.argv-driven scripts.' But session and timeout get no explicit meaning, leaving a real gap on a mutation-capable, no-annotation tool.

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?

States a specific verb+resource: 'Run a multi-line MicroPython script with FEMM's commands as globals.' The naming of the global API surface (mi_addnode, no femm. prefix) makes it immediately distinguishable from siblings like femm_run_lua and femm_eval without opening any schema.

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?

Gives clear mode-selection guidance: default inprocess for operating on the live session model, and batch explicitly for 'long independent jobs or sys.argv-driven scripts.' It lacks any explicit routing versus sibling script/eval tools (femm_run_lua, femm_eval, femm_call), but the internal when-to-use guidance is real and actionable.

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

Deploy Server

Other Tools