truncate_to_tokens
ActiveTool of IA-QA — 130+ QA & Dev Tools for AI Agents
Truncate text to at most N tokens (cl100k_base: ~4 chars/token) to avoid exceeding an LLM context window. Optionally keeps the end of the text instead of the start (useful for keeping recent conversation history). Reports whether truncation occurred and the estimated token count.
Parameters schema
{
"type": "object",
"required": [
"input",
"max_tokens"
],
"properties": {
"input": {
"type": "string",
"description": "Text to truncate"
},
"from_end": {
"type": "boolean",
"description": "Keep the end of the text instead of the start (default: false)"
},
"max_tokens": {
"type": "number",
"description": "Maximum number of tokens to keep"
}
}
}No endpoints wrapped at confidence ≥ 0.50.
Parent server
IA-QA — 130+ QA & Dev Tools for AI Agents
https://github.com/jcjamet/ia-qa
1/7 registries