token-gate-mcp
v0.1.3Token and context budget for AI agents.
These tools were reported by the server itself during our smoke test (tools/list), not copied from the README.
context.log
Record a token spend event into the session ledger. Call this after a read, a tool call, or a model turn so the budget report stays truthful.
| Parameter | Type | Description |
|---|---|---|
tokens * | integer | Tokens consumed |
chars | integer | Characters read or produced |
kind | string | What kind of work consumed the tokens |
note | string | What was spent on |
context.report
Return the current session token spend: totals, spend by kind, budget, and remaining budget.
context.estimate
Estimate the token cost of reading a file before reading it, and compare it with cheaper alternatives such as a graph query. Use this before a large read to protect the budget.
| Parameter | Type | Description |
|---|---|---|
path * | string | Path to the file that would be read |
alternativeCost | integer | Estimated token cost of the cheaper alternative, for example a graph query |
context.limit
Set or read the token budget for the session. With maxTokens set, stores the budget; without, returns the current budget and remaining tokens.
| Parameter | Type | Description |
|---|---|---|
maxTokens | integer | Budget in tokens. Omit to read the current budget. |
context.check
Check whether the session has gone over its token budget. Returns a boolean the agent can gate on before continuing.