Skip to main content
Glama

Convert format

convert_format
Read-only

Converts values or bit patterns between floating-point and integer formats, returning encoding details and precision-loss analysis for each representation.

Instructions

Convert a value or bit pattern from one floating-point or integer format to another. Returns full encoding details for both formats and precision loss analysis.

Input Schema

NameRequiredDescriptionDefault
bitsNoThe source as a bit pattern in the input format, binary (e.g. "0011110000000000") or hex with 0x prefix (e.g. "0x3C00"), read as decode_bits reads it and converted exactly as given. Use it to convert an exact encoding such as a NaN with a sign and payload. Exactly one of "value" and "bits" is required.
valueNoThe value to convert. Accepts a number, hex string (read as an integer, e.g. "0xFF" is 255), or keyword. Exactly one of "value" and "bits" is required.
nanModeNoWhat a NaN source operand becomes; it has no effect on any other input. "canonical" gives the output format's canonical quiet NaN. "preserve" keeps the sign and as many high-order payload bits as fit, and quiets the result (IEEE 754-2019 §6.2.3). Default "canonical". Only a "bits" source has a payload to keep.
inputFormatYesSource format preset key or custom format object.
outputFormatYesTarget format preset key or custom format object.
overflowModeNoWhat an out-of-range output magnitude becomes; the source operand is built with the input format's defaults. "overflow" produces Infinity (or NaN when the format has no Infinity); "saturate" clamps to the largest finite value. Omit to use the per-format default. IEEE 754 §7.4 directed rounding still clamps finite overflow regardless.
roundingModeNoRounding mode for encoding into the output format; the source operand is built with the input format's defaults. Options: "tiesToEven" (default, IEEE 754), "tiesToAway", "towardZero", "towardPositive", "towardNegative".

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.1.0

TDQS

A3.8/5.0
Behavior4/5

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

With readOnlyHint=true already declaring safety, the description adds useful behavioral context by stating that it returns full encoding details for both formats and precision loss analysis. It does not cover every edge case, but the schema's enum descriptions handle those details.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is two sentences, front-loaded with the core action and followed by the return behavior. It contains no filler and is appropriately sized for the tool.

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?

Given the rich input schema and read-only annotation, the description is largely complete for invocation and briefly explains the return contents. It does not enumerate the exact output shape, but no output schema exists and the stated return description is sufficient for an agent to understand what comes back.

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

Parameters3/5

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

Schema description coverage is 100%, so the input schema already documents all seven parameters in detail. The description adds no parameter-specific semantics beyond the schema and only broadly mentions value or bit pattern conversion.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description states a specific verb and resource: converting a value or bit pattern from one floating-point or integer format to another. It is clear and distinguishes the conversion role from encode/decode siblings implicitly, but it does not explicitly name or contrast with list_formats, encode_number, decode_bits, or get_format_info.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description implies when to use it by describing conversion between formats, and the presence of inputFormat/outputFormat makes the intended usage apparent. However, it does not explicitly say when to use this instead of encode_number or decode_bits, nor does it state any exclusions.

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