check_allowance
Check remaining daily API calls for EskomSePush. Monitor your usage to avoid exceeding the 50-call free tier limit.
Instructions
Check how many EskomSePush API calls you have remaining today. Free tier allows 50 calls per day.
Tool call template
This tool declares no required parameters. Add optional parameters from the input schema as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {},
"name": "check_allowance"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/index.ts:199-227 (handler)The tool handler function that calls client.getAllowance() and formats the response showing API quota usage (count, limit, remaining, type).
server.tool( "check_allowance", "Check how many EskomSePush API calls you have remaining today. Free tier allows 50 calls per day.", {}, async () => { const data = await client.getAllowance(); const { count, limit, type } = data.allowance; const remaining = limit - count; const pct = Math.round((remaining / limit) * 100); return { content: [ { type: "text", text: [ "## 📊 API Allowance", "", `Plan: **${type}**`, `Used today: **${count} / ${limit}**`, `Remaining: **${remaining}** (${pct}%)`, "", remaining < 10 ? "⚠️ Running low — use `test: true` on tools to avoid burning quota." : "✅ You have plenty of quota left.", ].join("\n"), }, ], }; } - src/index.ts:198-228 (registration)Registration of 'check_allowance' tool via server.tool() with empty schema (no input params) and a description.
// ── Tool 5: Check API quota ────────────────────────────────────────────────── server.tool( "check_allowance", "Check how many EskomSePush API calls you have remaining today. Free tier allows 50 calls per day.", {}, async () => { const data = await client.getAllowance(); const { count, limit, type } = data.allowance; const remaining = limit - count; const pct = Math.round((remaining / limit) * 100); return { content: [ { type: "text", text: [ "## 📊 API Allowance", "", `Plan: **${type}**`, `Used today: **${count} / ${limit}**`, `Remaining: **${remaining}** (${pct}%)`, "", remaining < 10 ? "⚠️ Running low — use `test: true` on tools to avoid burning quota." : "✅ You have plenty of quota left.", ].join("\n"), }, ], }; } ); - src/client.ts:87-90 (helper)The getAllowance() method on EskomSePushClient that makes an HTTP GET to /api_allowance endpoint and returns the Allowance response.
async getAllowance(): Promise<Allowance> { const { data } = await this.http.get<Allowance>("/api_allowance"); return data; } - src/client.ts:42-48 (schema)The Allowance interface defining the response shape: { allowance: { count, limit, type } }.
export interface Allowance { allowance: { count: number; limit: number; type: string; }; }