spend
Analyze API usage costs by capability and provider, showing total spend, execution counts, and cost averages for specified periods.
Instructions
Get your spend breakdown by capability and provider. Shows total spend, execution count, and cost averages. Defaults to current month.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| period | No | Period (YYYY-MM). Defaults to current month. |
Implementation Reference
- packages/mcp/src/tools/spend.ts:10-16 (handler)The handleSpend function, which takes SpendInput and an API client to fetch the spend breakdown.
export async function handleSpend( input: SpendInput, client: RhumbApiClient ): Promise<SpendOutput> { const result = await client.getSpend(input.period); return result as unknown as SpendOutput; } - packages/mcp/src/server.ts:244-257 (registration)The MCP tool 'spend' registration, which calls handleSpend to process the request.
// -- spend ------------------------------------------------------------ server.tool( "spend", "Get your spending breakdown for a billing period: total USD spent, call count, average cost per call, broken down by Capability and by provider. Use to audit costs or optimize routing.", { period: z.string().optional().describe(SpendInputSchema.properties.period.description) }, async ({ period }) => { const result = await handleSpend({ period }, client); return { content: [{ type: "text" as const, text: JSON.stringify(result) }] }; } );