Estimate token count
estimate_tokensEstimate a text's token count to plan API usage and costs. Uses Claude's count_tokens endpoint when an API key is present; otherwise falls back to a character-based approximation.
Instructions
テキストのトークン数を見積もる。API キーがあれば本文を Claude API の count_tokens に送る(外部通信)。無ければ文字数ベースの概算。 / Estimate a text's token count. With an API key the text is sent to the Claude count_tokens endpoint (outbound call); otherwise a rough character-based approximation.
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": "estimate_tokens"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| lang | No | 出力言語 / Output language | both |
| text | Yes | 対象テキスト / The text to measure |