Skip to main content
Glama
paladini

devutils-mcp-server

number_base_convert

Convert numbers between binary, octal, decimal, hexadecimal, or any base from 2 to 36. Specify the source and target bases to transform numerical values for programming, mathematics, or data analysis applications.

Instructions

Convert a number between different bases (binary, octal, decimal, hexadecimal, or any base 2-36).

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
valueYesThe number string to convert
from_baseNoSource base (2-36, default: 10)
to_baseNoTarget base (2-36, default: 16)

Implementation Reference

  • The tool 'number_base_convert' is registered and implemented within the same `server.tool` call in `src/tools/converters.ts`.
    server.tool(
      "number_base_convert",
      "Convert a number between different bases (binary, octal, decimal, hexadecimal, or any base 2-36).",
      {
        value: z.string().describe("The number string to convert"),
        from_base: z
          .number()
          .int()
          .min(2)
          .max(36)
          .default(10)
          .describe("Source base (2-36, default: 10)"),
        to_base: z
          .number()
          .int()
          .min(2)
          .max(36)
          .default(16)
          .describe("Target base (2-36, default: 16)"),
      },
      async ({ value, from_base, to_base }) => {
        try {
          const decimal = parseInt(value, from_base);
          if (isNaN(decimal)) {
            return {
              content: [
                {
                  type: "text" as const,
                  text: `Error: '${value}' is not a valid base-${from_base} number`,
                },
              ],
              isError: true,
            };
          }
    
          const result = {
            input: value,
            from_base,
            to_base,
            result: decimal.toString(to_base).toUpperCase(),
            decimal: decimal,
            binary: decimal.toString(2),
            octal: decimal.toString(8),
            hex: decimal.toString(16).toUpperCase(),
          };
    
          return {
            content: [
              { type: "text" as const, text: JSON.stringify(result, null, 2) },
            ],
          };
        } catch (e) {
          return {
            content: [
              {
                type: "text" as const,
                text: `Error: ${e instanceof Error ? e.message : String(e)}`,
              },
            ],
            isError: true,
          };
        }
      }
    );
Behavior3/5

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

No annotations provided, so description carries full disclosure burden. It successfully discloses supported base range (2-36), but fails to mention error behavior (e.g., invalid characters for specified base), output format, or whether the operation is pure/idempotent.

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?

Single 12-word sentence with zero waste. Front-loaded with action verb, parenthetical examples add density without verbosity, and every clause earns its place. Appropriate for a single-purpose utility function.

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?

Adequate for a simple 3-parameter conversion tool with 100% schema coverage. No output schema exists, but for this mathematical utility the return value is self-evident (the converted number string). Minor gap: doesn't describe error handling for malformed inputs.

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 has 100% description coverage establishing baseline 3. Description adds valuable semantic mapping by listing common bases (binary=2, octal=8, decimal=10, hexadecimal=16), helping users understand which integers to pass for from_base/to_base beyond the raw integer schema constraints.

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?

Clear specific verb 'Convert' + resource 'number' + scope 'between different bases (2-36)'. Explicitly distinguishes from string-encoding siblings like hex_encode and base64_encode by specifying 'number' and the base range, while also distinguishing from byte_convert (storage units) and color_convert.

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?

Provides implicit context through examples (binary, octal, decimal, hexadecimal) indicating common use cases. However, lacks explicit guidance on when to use this versus hex_encode/hex_decode (which encode strings, not convert numeric bases) or handling invalid inputs for the specified base.

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/paladini/devutils-mcp-server'

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