Skip to main content
Glama

set_loco_lights

Turn on or off all light-related functions of a DCC locomotive's address. Uses JMRI roster function labels to identify and toggle lights like headlights or cab lights.

Instructions

Turn ON/OFF EVERY light-related function of ONE locomotive in a single call.

Args: address: DCC address. Auto-acquires the throttle if needed. state: True to turn every light-related function on, False off.

Different from lights_on/lights_off (F0 only). Reads the roster function LABELS (set by the user in JMRI's roster editor — see get_locomotive_functions) and switches every function whose label names a light: "light"/"lamp"/"headlight" (EN) or "lumière"/"feu"/ "lampe"/"phare" (FR), case/accent-insensitive. Example: Autorail has F0="Lumières avant", F1="Lumières cabine", F2="Lumières arrières" — all three light-labeled, so "all lights" must flip all three, not just F0. Use for "all"/"every"/"toutes les lumières" with a named locomotive — never loop set_function yourself.

No light-labeled functions is NOT an error: returns an empty "applied" list with a "note". Only ask for an explicit F-number as a fallback then.

For "all locos" (no locomotive named), use set_all_locos_lights. For layout/scenery lighting (JMRI Light objects), use set_layout_lights instead.

Returns {"address", "applied": [{"function", "label", "state"}...], "failed": [...]} — catch-and-continue per function.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
stateYes
addressYes
Behavior5/5

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

Details auto-acquire throttle, label matching (English/French, case/accent-insensitive), catch-and-continue per function, and that no light-labeled functions returns a note. No annotations, so description carries full burden and meets it.

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?

Well-structured with args, behavior, examples, sibling distinctions, and return format. Slightly long but every part adds value. Could be trimmed slightly without loss.

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?

Covers return format (address, applied list, failed list), edge cases (no light-labeled functions), and complex behavior (label matching, language detection) without needing output schema.

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 coverage is 0%, but description fully explains address (DCC address, auto-acquires throttle) and state (boolean for on/off) and how they are used in the logic. Adds significant meaning beyond raw schema.

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?

Clearly states it turns ON/OFF every light-related function of ONE locomotive. Distinguishes from sibling tools like lights_on/lights_off (F0 only) and set_function (requires looping).

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 says when to use: for 'all'/'every' lights with a named locomotive. Provides alternative tools for 'all locos' (set_all_locos_lights) and layout lighting (set_layout_lights). Advises against looping set_function.

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/HO44-PROJECT/MrJ-JMRI-MCP'

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