Skip to main content
Glama
phiresky
by phiresky

lua_exec

Execute Lua code on the Factorio server to query game state or perform custom actions. Use 'return' to capture results.

Instructions

Execute Lua code on the Factorio server via /silent-command. The code is wrapped in a function — use 'return' to send results back. Results are serialized via serpent.line for tables. Use this for any game state query not covered by specific tools.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
codeYesLua code to execute. Use 'return expr' to get a value back. Tables are auto-serialized.
Behavior2/5

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

No annotations provided, so description bears full burden. Discloses code wrapping and serialization but fails to state whether tool is read-only or can modify game state. This is a critical omission for an execution tool that could be destructive.

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 succinct sentences with no redundancy. Front-loaded with action and target.

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?

Provides purpose, usage, result handling, and when-to-use. Lacks error handling or security notes, but for a single-param tool with clear schema, this is sufficient. No output schema, so return format covered.

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 coverage is 100% and description adds useful semantics: 'Use 'return expr' to get a value back. Tables are auto-serialized.' Enhances understanding beyond schema's code description.

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 clearly states the tool executes Lua code via /silent-command and distinguishes it from sibling tools by noting it's for queries not covered by specific tools. The verb 'Execute' and resource 'Lua code on the Factorio server' are specific.

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 explicit context: 'Use this for any game state query not covered by specific tools.' Gives usage instructions on wrapping code, using 'return', and serialization. Lacks explicit when-not-to-use or alternative references beyond sibling list.

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/phiresky/factorio-mcp'

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