Skip to main content
Glama

set_direction

Sets a locomotive's direction (forward/reverse) via its DCC address. For smooth operation, stop the loco before changing direction.

Instructions

Set a locomotive's direction of travel: "forward" or "reverse".

Args: address: The locomotive's DCC address. Acquires the throttle automatically if this session doesn't already hold it. direction: Must be exactly "forward" or "reverse" (case- insensitive). "forward"/"reverse" here mean the loco's own notion of front/back as wired in its decoder — not compass direction or "toward/away from the operator" — so if a user says "turn it around" or "go the other way", flip whatever the current reported direction is rather than guessing.

Best practice: for a moving loco, bring it to a stop first — DCC decoders generally accept a direction change at speed, but it can cause a rough jolt or be ignored/delayed by the decoder depending on its configuration; this tool does not enforce that, it just forwards the request.

Returns the direction JMRI actually reports back as "forward" or "reverse" (translated from JMRI's own true/false), not "stopped" — direction and speed are independent fields on the same throttle, so set_direction never changes speed and doesn't report one.

Like set_speed/stop/emergency_stop, this is safe to call repeatedly with the same direction: JMRI silently no-ops a redundant "already going this way" request instead of replying, and this tool checks a local direction cache — kept fresh by JMRI's own broadcasts of state changes from ANY client, not just this one — before deciding whether to send anything, so a repeat call (or a direction that was actually last changed by a JMRI panel/PanelPro, not this session) still reports the correct current direction instead of hanging.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
addressYes
directionYes
Behavior5/5

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

With no annotations, the description fully covers key behaviors: auto-acquires throttle, case-insensitivity, meaning of forward/reverse (locomotive's own front/back), safety of repeated calls due to local cache, return value description, and independence from speed. Also warns about potential jolt.

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?

The description is thorough and well-structured, with separate paragraphs for args, best practice, returns, and repeat-call behavior. Every sentence adds value, though it could be slightly more compact without losing clarity.

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 no output schema, the description includes return value details. It covers edge cases (changes while moving, repeated calls, caches) and explains the tool's scope (direction only, no speed change). Complete for the tool's purpose.

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?

Input schema has 0% coverage, so description must define both parameters. It does so explicitly: address is DCC address with auto-throttle acquisition; direction must be exactly 'forward' or 'reverse' (case-insensitive) with meaning clarified. No ambiguity.

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 action ('Set a locomotive's direction of travel') and the resource (direction of a locomotive), with specific allowed values. It distinguishes itself from sibling tools by referencing set_speed/stop/emergency_stop as related but different.

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 best practice to stop a moving loco before changing direction, explains that repeated calls are safe, and contrasts with siblings. Does not explicitly state when not to use, but the context is sufficient.

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