Skip to main content
Glama

reload_code

Hot-reload a Lua file into a running LÖVE game to apply code changes without restarting, clearing require() cache and re-running the file.

Instructions

Hot-reload a Lua file from disk into the running game (default 'main.lua'). LÖVE does NOT pick up file edits on its own — without this tool, changes you write to disk have zero effect until the game is restarted. This clears the require() cache for every game module first (so edits to files required by main.lua are picked up too, not just main.lua itself), then re-runs the file and calls love.load() again — it behaves like restarting the level with the new code rather than a state-preserving patch. Module tables themselves are reloaded via in-place mutation (same table identity, new contents), so any other system that already did local X = require(...) and kept that reference will see the updated code automatically — you do NOT need to manually re-point those. This does NOT apply to instances created from a module before the reload (e.g. an object made with Class.new()) — those keep their old field values and identity; if something else is holding a reference to a specific pre-reload instance, use run_lua to re-point it manually, or design around ids/lookup tables instead of raw instance references.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
fileNoPath relative to the game's source folder. Defaults to 'main.lua'.

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv1.0.0

TDQS

A4.4/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 clears the require() cache, re-runs the file, calls love.load(), uses in-place table mutation, and explicitly scopes what it does NOT affect (pre-reload instances). This is exactly the side-effect disclosure a mutation tool 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-loaded with the core action, then layers genuinely useful caveats rather than filler. It is long, but nearly every sentence carries behavioral information that an agent needs before invoking.

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 one-parameter mutation tool with no annotations and no output schema, the description is complete: it covers purpose, side effects, reload semantics, and the exact boundary of what gets updated.

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 coverage is 100% and the single param is fully documented, so the baseline is 3. The description's '(default main.lua)' merely repeats the schema and adds no new syntax or format detail.

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 and resource ('hot-reload a Lua file from disk into the running game') with the default scope named. It is clearly distinguishable from siblings like run_lua and list_lua_files 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?

Explains the trigger condition precisely ('LÖVE does NOT pick up file edits on its own'), so the agent knows when this tool is required. It routes a specific sub-case to run_lua, but does not give a broader when-not-to-use matrix.

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