Skip to main content
Glama

set_speed

Set a locomotive's speed as a percentage of its maximum using its DCC address. The tool acquires the throttle if needed and returns the actual speed JMRI reports.

Instructions

Set a locomotive's speed as a percentage of its maximum (0-100%).

Args: address: The locomotive's DCC address. speed_percent: 0-100. Values outside this range are clamped, not rejected. Acquires the throttle automatically if this session doesn't already hold it — no need to call acquire_throttle first for a simple "speed up the 3" style voice command.

Returns the actual speed JMRI reports back, as a percentage — this may differ slightly from what was requested (DCC uses a small number of discrete speed steps, so exact percentages get rounded).

Use stop for a controlled halt (speed 0%) or emergency_stop for a panic stop — don't call set_speed(speed_percent=0) for an emergency, it's a different command to JMRI, not just "speed 0".

A locomotive's speed can be changed by something other than this tool at any time — another JMRI panel, PanelPro, another MCP/voice session controlling the same loco. If the requested speed already matches the current one (whoever set it), JMRI does not send a confirmation and this call returns immediately without writing anything new to the layout — this is expected, not a failure; the reported speed_percent in the response is still accurate because it's read from a cache kept continuously up to date by JMRI's own state broadcasts, not from what this tool last sent.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
addressYes
speed_percentYes
Behavior5/5

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

With no annotations, the description carries full burden. It discloses clamping, automatic throttle acquisition, rounding due to DCC steps, behavior when speed matches current (no-op), and that speed can be changed by other sources. Returns actual speed from JMRI cache.

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?

Description is somewhat long but every sentence adds value. Front-loaded with main purpose. Could be slightly more concise, but still well-structured and efficient.

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 covers all necessary context: purpose, edge cases, return value, comparisons to alternatives, and operational nuances. Fully complete for an AI agent.

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%, so description must compensate. It defines address as 'The locomotive's DCC address' and speed_percent as '0-100. Values outside this range are clamped, not rejected.' Adds meaningful usage context beyond schema types.

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 sets a locomotive's speed as a percentage of maximum (0-100%). Distinguishes from siblings like stop and emergency_stop by specifying when to use those alternatives.

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 provides when to use and when not to use, including alternatives: 'Use stop for a controlled halt (speed 0%) or emergency_stop for a panic stop — don't call set_speed(speed_percent=0) for an emergency'. Also explains automatic throttle acquisition and idempotent behavior when speed unchanged.

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