Skip to main content
Glama

segment

Tokenize a list of marks in a given language using language-specific segmentation, returning tokens per mark for direct use in chapter creation.

Instructions

Tokenise a list of marks via cwseg (jieba/fugashi/kiwipiepy for CJK, regex for EU). Always batch every mark in ONE call — per-mark calls flake under rate limits.

Returns {"tokens_per_mark": [["tok1","tok2",...], ...]} parallel to marks — feed this directly to cjk-glosser and back into create_chapter_from_marks(tokens_per_mark=...) so cwbe and the agent see the same tokens.

Args: language: Source language code (EN | FR | ES | DE | IT | PT | ZH | JA | KO). marks: List of mark texts. All in the same language.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
languageYes
marksYes

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes
Behavior4/5

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

With no annotations provided, the description must disclose behavioral traits. It does so by describing the tokenization algorithm (cwseg with engine selection based on language), the batching requirement to avoid rate limits, and the return format. It does not mention side effects or permissions, which are likely minimal for a tokenization tool, but it is still fairly transparent.

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?

The description is succinct, with two short paragraphs. The first paragraph states the purpose and a key guideline, and the second explains the return format and arguments. It is well-structured and front-loaded. Slightly more conciseness could be achieved by combining some sentences, but it is not verbose.

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 tool's simplicity (2 parameters, no annotations, output schema inferred from description), the description is sufficiently complete. It covers the purpose, usage pattern, parameters, and integration with sibling tools. It lacks details about error handling or edge cases, but these are not critical for a tokenization tool with a well-defined input.

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

Parameters5/5

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

The input schema has 0% description coverage for parameters, so the description must compensate. It does this effectively by explaining the 'language' parameter with examples (EN, FR, ES, etc.) and the 'marks' parameter as a list of mark texts all in the same language. This adds significant meaning beyond the bare 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 'Tokenise a list of marks via cwseg' and specifies the engines used for different languages (CJK vs EU). It distinguishes the tool from siblings like gloss_tokens and validate_marks by focusing on tokenization and providing the return format and usage pattern.

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 includes a critical usage guideline: 'Always batch every mark in ONE call — per-mark calls flake under rate limits.' It also explains how to feed the output to sibling tools (cjk-glosser and create_chapter_from_marks), providing a clear usage pattern. However, it does not explicitly state when not to use the tool or mention alternative tools.

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/paulmichaelstafford/cwmcp'

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