Skip to main content
Glama

Rake

Calculate a UART baud rate divisor

calc_uart_baud
Read-onlyIdempotent

Computes the divisor for a UART baud rate from the peripheral clock, with the real baud rate and its error in percent, and the BRR value for STM32. Use it to set a baud rate or to find out why a link shows framing errors or garbage. The peripheral generic fits any UART that divides its clock by a whole number, with 16 or 8 samples a bit. For the STM32 USART and LPUART it also gives the BRR value.

Tool call template

Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {
      "peripheral": "<peripheral>",
      "clock_hz": "<clock_hz>",
      "baud": "<baud>"
    },
    "name": "calc_uart_baud"
  }
}

Input Schema

NameRequiredDescriptionDefault
baudYesThe baud rate, for example 115200.
clock_hzYesThe clock of the UART in Hz.
peripheralYesgeneric, stm32-usart or stm32-lpuart.
oversamplingNoSamples per bit, 16 or 8. Default 16. The LPUART ignores it.

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observed

TDQS

A4.1/5.0
Behavior3/5

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

Annotations already declare this as a read-only, idempotent, closed-world calculation, so the safety profile is covered. The description usefully discloses what comes back (divisor, actual baud rate, percentage error, BRR) — which matters since there is no output schema — but says nothing about accuracy limits, rounding behavior, or the sign/interpretation of the error value.

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?

Three tight sentences, front-loaded with the core computation and followed by the output summary and applicability note. The one redundancy is the STM32 BRR mention appearing in both the first and last sentences, which slightly dilutes the otherwise efficient structure.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

With no output schema, the description does the necessary work of enumerating the returned values and the conditions under which BRR is present, so an agent knows what to expect. It could go one step further by clarifying the units/type of the divisor and how to read the error percentage, but nothing essential for correct invocation is missing.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 100%, so baseline is 3, and the description genuinely adds meaning on top: it explains that 'generic' fits any UART dividing its clock by a whole number with 16 or 8 samples per bit, and that BRR is only produced for the STM32 variants. That clarifies the enum's semantics beyond the schema's terse value list.

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 ('Computes the divisor for a UART baud rate from the peripheral clock') and immediately names the outputs (real baud rate, error percent, STM32 BRR). This plainly distinguishes it from the CAN, I2C, timer and watchdog timing siblings without needing their names.

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?

Gives concrete usage contexts: setting a baud rate, or diagnosing framing errors/garbage on a link. It also scopes when the 'generic' peripheral applies versus the STM32 variants. It stops short of explicit when-not guidance or naming an alternative tool, so it is clear context rather than full routing.

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

Try in Browser

Glama MCP Gateway

Add one secure layer between your agents and this server.

Resources