get_weekly_limits
Retrieve your 7-day weekly usage limits for Claude models, including breakdowns for Opus, Sonnet, and combined totals.
Instructions
Get your 7-day weekly usage limits broken down by model: all models combined, Opus, and Sonnet.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/index.ts:59-74 (handler)The registration and handler implementation for the 'get_weekly_limits' tool in src/index.ts. It calls fetchUsage() and formats the output using formatWeeklyLimits().
server.tool( "get_weekly_limits", "Get your 7-day weekly usage limits broken down by model: all models combined, Opus, and Sonnet.", {}, async () => { const result = await fetchUsage(); if (!result.data) { return { content: [{ type: "text", text: result.error ?? "Failed to fetch usage data." }], isError: true, }; } return { content: [{ type: "text", text: formatWeeklyLimits(result.data) }] }; } - src/formatter.ts:139-151 (helper)The helper function 'formatWeeklyLimits' which processes the usage data to produce the formatted string for the 'get_weekly_limits' tool.
export function formatWeeklyLimits(data: UsageResponse): string { const lines: string[] = []; lines.push("=== Weekly Limits (7-day) ==="); lines.push(""); lines.push(formatWindow("All Models", data.seven_day)); lines.push(""); if (data.seven_day_opus !== undefined) { lines.push(formatWindow("Opus Only", data.seven_day_opus)); lines.push(""); }