check_usage
Monitor your monthly API usage and plan limits to manage resources effectively.
Instructions
Check your current monthly API usage and plan limits.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/index.ts:232-265 (handler)The 'check_usage' tool is registered and implemented directly using server.tool, calling the /usage endpoint of the StripFeed API.
server.tool( "check_usage", "Check your current monthly API usage and plan limits.", {}, async () => { const apiKey = getApiKey(); const response = await fetch(`${BASE_URL}/usage`, { headers: { Authorization: `Bearer ${apiKey}` }, }); if (!response.ok) { const body = await response.text(); let message: string; try { message = JSON.parse(body).error; } catch { message = body; } throw new Error(`StripFeed API error ${response.status}: ${message}`); } const data = await response.json(); const lines = [ `Plan: ${data.plan}`, `Usage: ${data.usage.toLocaleString()}${data.limit ? ` / ${data.limit.toLocaleString()}` : ' (unlimited)'}`, ]; if (data.remaining !== null) lines.push(`Remaining: ${data.remaining.toLocaleString()}`); lines.push(`Resets: ${data.resetsAt}`); return { content: [{ type: "text" as const, text: lines.join("\n") }], }; } );