Skip to main content
Glama

Truncate to a UTF-8 budget

bpj_truncate_utf8_budget
Read-onlyIdempotent

Fit text into a UTF-8 byte budget without cutting a code point.

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": {
      "text": "<text>",
      "bytes": "<bytes>"
    },
    "name": "bpj_truncate_utf8_budget"
  }
}

Input Schema

NameRequiredDescriptionDefault
textYes
bytesYes

Schema Changelog

Changes observed during successful MCP inspections.

  1. Added

TDQS

B3.1/5.0
Behavior3/5

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

Annotations already declare readOnly, idempotent, non-destructive, closed-world, so the safety profile is covered. The description adds one genuine behavioral guarantee beyond them: the cut respects code point boundaries, so output is always valid UTF-8. It omits other meaningful behavior, such as whether it keeps a prefix or suffix, what happens if the budget is smaller than one code point, and what happens when the text already fits.

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?

A single front-loaded sentence with no filler; every clause carries information. It is arguably too terse for a tool with no output schema and zero parameter documentation, but as a conciseness measure it is clean.

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

Completeness2/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 should state what comes back (a truncated string, presumably, but the shape is unstated). Combined with 0% schema description coverage on both parameters and no mention of the fits-within-budget case, the definition leaves real operational questions for the agent to guess.

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 0%, so the description must carry the load. 'UTF-8 byte budget' usefully disambiguates the 'bytes' parameter as UTF-8 byte count rather than character count, which the schema title 'Byte limit' leaves ambiguous. It says nothing about the text parameter, the 6000-char cap, the 24000-byte ceiling, or the relationship between the two.

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?

Specific verb+resource: truncate text to a byte budget, with the added qualifier that code points are never split. An agent can tell this is a text-fitting/truncation utility. It does not, however, distinguish itself from the near-identical sibling bpj_truncate_grapheme_budget, which is the one case where the boundary rule is the deciding factor.

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

Usage Guidelines2/5

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

The description states what it does but never says when to reach for it instead of the grapheme-based sibling, nor whether it is meant for transport/storage limits versus display width. Usage is inferable only from the tool name, not from any guidance in the description.

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.