get_usage
Retrieve API usage data including search counts and per-user breakdowns. Filter by specific months to analyze platform consumption patterns.
Instructions
Get API usage data. Returns search counts and per-user breakdowns. Optionally filter by month.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| month | No | Month to query (YYYY-MM format). Omit to get the last 12 months. |
Implementation Reference
- src/tools/usage.ts:5-26 (registration)The registration and handler implementation for the 'get_usage' tool.
export function register(server: McpServer) { server.tool( "get_usage", "Get API usage data. Returns search counts and per-user breakdowns. Optionally filter by month.", { month: z .string() .regex(/^\d{4}-\d{2}$/, "Must be YYYY-MM") .optional() .describe("Month to query (YYYY-MM format). Omit to get the last 12 months."), }, async (params) => { try { const query = params.month ? `?month=${params.month}` : ""; const data = await apiGet(`/usage${query}`); return { content: [{ type: "text", text: JSON.stringify(data, null, 2) }] }; } catch (e) { return { content: [{ type: "text", text: String(e) }], isError: true }; } } ); }