Skip to main content
Glama

set_direction

Set a locomotive's direction (forward/reverse) using its DCC address. Automatically acquires throttle and safely handles repeated or external direction changes.

Instructions

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

Args: address: DCC address. Auto-acquires the throttle if needed. direction: Exactly "forward" or "reverse" (case-insensitive) — the decoder's own front/back, not compass direction. For "turn it around"/"go the other way", flip the current reported direction rather than guessing.

Best practice: stop a moving loco first — a direction change at speed can jolt or be ignored depending on the decoder; this tool doesn't enforce that, just forwards the request.

Returns direction as "forward"/"reverse" (translated from JMRI's true/false) — independent of speed, never changed here.

Safe to call repeatedly with the same direction: JMRI silently no-ops a redundant request, and a local cache (kept fresh by JMRI's own broadcasts from ANY client) avoids hanging on a repeat or externally-set direction.

In exhibition mode, "reverse" is REFUSED outright (returns an error, does not silently force forward — there's no speed change here to narrate as "moving anyway") — "forward" still works normally. See enter_exhibition_mode.

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 discloses behaviors: auto-acquires throttle, does not enforce stopping, returns direction as string independent of speed, is safe to call repeatedly (no-op), and handles exhibition mode explicitly.

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 front-loaded purpose, clear sections for args, best practices, return value, and edge cases. Slightly verbose but every sentence adds value; could be trimmed slightly for extreme conciseness.

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 2 parameters, no output schema, and no annotations, the description is exceptionally complete: covers all behavioral aspects, edge cases (exhibition mode, redundant calls), return format, and ties to related tool (enter_exhibition_mode).

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 description coverage is 0%, but the description explains both parameters thoroughly: address (DCC, auto-acquire) and direction ('forward'/'reverse', case-insensitive, meaning relative to decoder). Adds crucial meaning beyond the 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?

The description clearly states the tool sets a locomotive's direction to 'forward' or 'reverse' using a DCC address. It distinguishes from sibling tools like set_speed and stop by specifying the exact action and parameters.

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?

Provides explicit when-to-use and when-not-to-use: best practice to stop a moving loco first, warns of jolt/ignored command, explains behavior in exhibition mode (reverse refused), and suggests flipping current direction for 'turn around'.

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