llmkit_session_summary
Read-onlyIdempotent
Retrieve recent AI session summaries with cost, duration, and models used to track spending and usage across multiple providers.
Instructions
Get recent proxy sessions with cost, duration, and models used
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| sessionId | No | Specific session ID | |
| limit | No | Number of sessions (default 10) |
Output Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| sessions | Yes |
Implementation Reference
- The handler function that executes the logic for the llmkit_session_summary tool.
export async function handleSessionSummary(args: Record<string, unknown> | undefined) { const sessionId = args?.sessionId as string | undefined; const limit = (args?.limit as number) || 10; const sessData = await getSessions(sessionId, limit); const sessions = sessData.sessions.map(s => { const dur = new Date(s.last).getTime() - new Date(s.first).getTime(); return { sessionId: s.sessionId, requests: s.requests, costUsd: cents(s.costCents), durationMinutes: Math.round(dur / 60000), providers: s.providers, models: s.models }; }); if (!sessions.length) { return ok(sessionId ? `Session ${sessionId} not found.` : 'No sessions found.', { sessions }); } return ok([ 'Sessions', '\u2500'.repeat(25), ...sessions.map(s => { const dur = s.durationMinutes < 1 ? '<1m' : `${s.durationMinutes}m`; return `${s.sessionId}: ${s.requests} reqs, $${s.costUsd.toFixed(2)}, ${dur}, ${s.providers.join('+')} / ${s.models.join(', ')}`; }), ].join('\n'), { sessions }); } - Tool definition and schema for llmkit_session_summary.
name: 'llmkit_session_summary', description: 'Get recent proxy sessions with cost, duration, and models used', inputSchema: { type: 'object' as const, properties: { sessionId: { type: 'string', description: 'Specific session ID' }, limit: { type: 'number', description: 'Number of sessions (default 10)' }, }, }, outputSchema: { type: 'object' as const, properties: { sessions: { type: 'array', items: { type: 'object', properties: { sessionId: { type: 'string' }, requests: { type: 'number' }, costUsd: { type: 'number' }, durationMinutes: { type: 'number' }, providers: { type: 'array', items: { type: 'string' } }, models: { type: 'array', items: { type: 'string' } } } } }, }, required: ['sessions'], }, annotations: { title: 'Session Summary', ...HINTS }, }, - packages/mcp-server/src/tools.ts:297-297 (registration)Mapping of the tool name to its handler function in the HANDLER_MAP.
llmkit_session_summary: handleSessionSummary,