Text tokenization utilities: count tokens, encode text to token IDs, truncate to a token limit, split text into chunks, estimate cost.
| Parameter | Type | Description |
|---|---|---|
| operationrequired | string | Operation: count (token count), encode (text → token IDs), truncate (cut to maxTokens), split (chunk with overlap), estimate (cost estimate). One of: count, encode, truncate, split, estimate. |
| textrequired | string | Input text to process. |
| modeloptional | string | Target model name (e.g. gpt-4, claude-3). Affects tokenization heuristic. |
| maxTokensoptional | integer | Token limit for truncate/split. Default: 4096. |
| overlapoptional | integer | Overlap tokens between chunks for split. Default: 0. |
| Field | Type | Description |
|---|---|---|
| No output fields defined | ||
No examples available.
ppm install mcp-tokenizer
GET /v1/packages/mcp-tokenizer/1.0.7/schema
GET /v1/mcp/discover?q=tokenizer
ppm install mcp-tokenizer or invoke remotely via POST /v1/invoke/mcp-tokenizer on the MCP Service.