lmstudio_count_tokens
Count tokens in text using a loaded model's own tokenizer and compare the result with its context length, so you can verify prompts fit before sending them.
Instructions
Count tokens in a text using a loaded model's own tokenizer, and compare with its context length.
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>"
},
"name": "lmstudio_count_tokens"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| text | Yes | ||
| model | No | Loaded identifier or key. Default: any loaded LLM. |