Skip to main content
Glama
collapseindex

CI-1T Prediction Stability Engine

convert_scores

Convert probability floats to Q0.16 fixed-point integers for stability evaluation, and revert Q0.16 outputs to readable floats.

Instructions

Convert between probability floats (0.0–1.0) and Q0.16 fixed-point integers (0–65535) — no API call, no auth, no credits. Response: { direction, count, converted: [{ input, q16|float }] }. Use to_q16 before evaluate, from_q16 to make CI outputs human-readable.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
scoresYesArray of scores to convert
directionYes"to_q16" converts 0.0–1.0 floats to Q0.16 integers. "from_q16" converts Q0.16 integers to floats.

Implementation Reference

  • src/index.ts:868-907 (registration)
    Registration of the 'convert_scores' tool via server.tool() with the name 'convert_scores'.
    server.tool(
      "convert_scores",
      "Convert between probability floats (0.0–1.0) and Q0.16 fixed-point integers (0–65535) — no API call, no auth, no credits. Response: { direction, count, converted: [{ input, q16|float }] }. Use to_q16 before evaluate, from_q16 to make CI outputs human-readable.",
      {
        scores: z.array(z.number()).min(1).max(300).describe("Array of scores to convert"),
        direction: z.enum(["to_q16", "from_q16"]).describe('"to_q16" converts 0.0–1.0 floats to Q0.16 integers. "from_q16" converts Q0.16 integers to floats.'),
      },
      async ({ scores, direction }) => {
        if (direction === "to_q16") {
          const converted = scores.map((s) => {
            const clamped = Math.max(0, Math.min(1, s));
            const q16 = Math.round(clamped * Q16);
            return { input: s, q16, clamped: s !== clamped };
          });
          return {
            content: [
              {
                type: "text" as const,
                text: JSON.stringify({ direction, count: scores.length, converted }, null, 2),
              },
            ],
          };
        }
    
        // from_q16
        const converted = scores.map((s) => {
          const clamped = Math.max(0, Math.min(Q16, Math.round(s)));
          const float_val = Number((clamped / Q16).toFixed(6));
          return { input: s, float: float_val };
        });
        return {
          content: [
            {
              type: "text" as const,
              text: JSON.stringify({ direction, count: scores.length, converted }, null, 2),
            },
          ],
        };
      }
    );
  • Zod input schema for convert_scores: 'scores' (array of numbers, 1-300) and 'direction' (enum: 'to_q16' or 'from_q16').
    {
      scores: z.array(z.number()).min(1).max(300).describe("Array of scores to convert"),
      direction: z.enum(["to_q16", "from_q16"]).describe('"to_q16" converts 0.0–1.0 floats to Q0.16 integers. "from_q16" converts Q0.16 integers to floats.'),
    },
  • Handler function implementing the conversion logic. For 'to_q16': clamps input 0-1 and multiplies by 65535. For 'from_q16': clamps to 0-65535 and divides by 65535, returning a 6-decimal float.
      async ({ scores, direction }) => {
        if (direction === "to_q16") {
          const converted = scores.map((s) => {
            const clamped = Math.max(0, Math.min(1, s));
            const q16 = Math.round(clamped * Q16);
            return { input: s, q16, clamped: s !== clamped };
          });
          return {
            content: [
              {
                type: "text" as const,
                text: JSON.stringify({ direction, count: scores.length, converted }, null, 2),
              },
            ],
          };
        }
    
        // from_q16
        const converted = scores.map((s) => {
          const clamped = Math.max(0, Math.min(Q16, Math.round(s)));
          const float_val = Number((clamped / Q16).toFixed(6));
          return { input: s, float: float_val };
        });
        return {
          content: [
            {
              type: "text" as const,
              text: JSON.stringify({ direction, count: scores.length, converted }, null, 2),
            },
          ],
        };
      }
    );
  • Helper function 'toQ16' used by other tools (evaluate, fleet_evaluate, interpret_scores) to auto-convert float scores to Q0.16. This is a supporting helper but not directly used by convert_scores itself.
    /** Auto-convert: if all values are 0–1 floats with decimals, scale to Q0.16. Otherwise clamp to 0–65535. */
    function toQ16(scores: number[]): number[] {
      const hasDecimals = scores.some((s) => s % 1 !== 0);
      const allInUnit = scores.every((s) => s >= 0 && s <= 1);
      const isFloat = hasDecimals && allInUnit;
      return isFloat
        ? scores.map((s) => Math.round(Math.max(0, Math.min(1, s)) * Q16))
        : scores.map((s) => Math.round(Math.max(0, Math.min(Q16, s))));
    }
  • Constant Q16 = 65535 used for Q0.16 fixed-point conversion in the convert_scores handler and throughout the codebase.
    const Q16 = 65535;
Behavior4/5

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

No annotations provided, but the description discloses no API call, no auth, no credits, and shows the response structure. It lacks details on error handling for out-of-range inputs, but for a simple conversion this is mostly sufficient.

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 a single clear paragraph with front-loaded purpose, response format, and usage hints. Every sentence adds value with no waste.

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?

For a simple two-parameter tool with no output schema, the description covers conversion logic, response structure, and usage. It omits boundary error behavior, but overall it is adequately complete.

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%, and the description adds context by specifying the numeric ranges and response fields. It reinforces the meaning of the parameters without repeating 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 converts between probability floats and Q0.16 integers, with exact ranges and response format. It distinguishes itself from sibling tools by noting it's a no-API, no-auth, no-credit utility.

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?

The description provides explicit usage hints: 'Use to_q16 before evaluate, from_q16 to make CI outputs human-readable.' It implies the tool is a quick conversion step, but does not elaborate on when to avoid it (e.g., if inputs are already in the correct format).

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/collapseindex/ci-1t-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server