Skip to main content
Glama

llmkit_local_projects

Track cumulative AI coding costs across all projects and sessions. Monitor spending from 11 AI providers to manage budgets and analyze usage patterns.

Instructions

Cumulative cost across all projects and sessions from all detected AI coding tools, ranked by spend.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The handler function that retrieves and formats project cost data from AI coding tool adapters.
    export async function handleLocalProjects() {
      const active = await detectAdapters();
      if (active.length === 0) return fail('No AI coding tool data found. Works with Claude Code and Cline.');
    
      const allProjects: LocalProjectSummary[] = [];
      const results = await Promise.allSettled(active.map(a => a.getProjects()));
      for (const r of results) {
        if (r.status === 'fulfilled') allProjects.push(...r.value);
      }
    
      if (allProjects.length === 0) return fail('No project data found.');
    
      allProjects.sort((a, b) => b.totalCost - a.totalCost);
      const totalCost = allProjects.reduce((s, p) => s + p.totalCost, 0);
    
      const lines = [
        'Project Costs (cumulative, all tools)',
        '\u2500'.repeat(25),
        `${allProjects.length} projects, $${totalCost.toFixed(2)} total`,
        '',
      ];
    
      for (const p of allProjects) {
        const tokens = p.totalInputTokens + p.totalOutputTokens;
        lines.push(`${p.project}: $${p.totalCost.toFixed(2)} across ${p.sessionCount} sessions (${p.totalMessages} msgs, ${(tokens / 1000).toFixed(0)}k tokens) [${p.source}]`);
      }
    
      return ok(lines.join('\n'), { projects: allProjects, totalCostUsd: totalCost });
    }
  • The definition and schema registration of the llmkit_local_projects tool.
      name: 'llmkit_local_projects',
      description: 'Cumulative cost across all projects and sessions from all detected AI coding tools, ranked by spend.',
      inputSchema: { type: 'object' as const, properties: {} },
      outputSchema: {
        type: 'object' as const,
        properties: {
          projects: { type: 'array', items: { type: 'object', properties: { source: { type: 'string' }, project: { type: 'string' }, sessionCount: { type: 'number' }, totalCost: { type: 'number' }, totalMessages: { type: 'number' }, topModel: { type: 'string' } } } },
          totalCostUsd: { type: 'number' },
        },
        required: ['projects', 'totalCostUsd'],
      },
      annotations: { title: 'Project Costs', ...HINTS },
    },

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/smigolsmigol/llmkit-mcp-server'

If you have feedback or need assistance with the MCP directory API, please join our Discord server