get_api_usage
Check current YNAB API usage against the 200 calls/hour rate limit to ensure sufficient budget before batch operations.
Instructions
[0 API calls] Check current YNAB API usage against the 200 calls/hour rate limit. Use this before batch operations to ensure you have enough budget.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/tools/api-usage.ts:13-25 (handler)The handler function for 'get_api_usage' that retrieves usage stats from the API usage tracker and formats the output.
}, async () => { const usage = apiUsageTracker.getUsage(); const lines = [ `YNAB API Usage:`, ` Calls used (last hour): ${usage.used}`, ` Calls remaining: ${usage.remaining}`, ` Rate limit: ${usage.limit}/hour`, ]; if (usage.windowResetsAt) { lines.push(` Next call expires at: ${usage.windowResetsAt}`); } return textResult(lines.join("\n")); }); - src/tools/api-usage.ts:6-12 (registration)Registration of the 'get_api_usage' tool, including its schema and description.
server.registerTool("get_api_usage", { title: "Get API Usage", description: "[0 API calls] Check current YNAB API usage against the 200 calls/hour rate limit. " + "Use this before batch operations to ensure you have enough budget.", inputSchema: {}, annotations: { readOnlyHint: true },