Skip to main content
Glama

llmkit_local_session

Read-onlyIdempotent

Track current session costs across AI coding tools like Claude Code and Cline without requiring API keys.

Instructions

Current session cost across all detected AI coding tools (Claude Code, Cline). No API key needed.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
sessionsNo
sourceCountYes
totalCostUsdYes

Implementation Reference

  • The handleLocalSession function retrieves and summarizes costs from active local AI coding tool sessions.
    export async function handleLocalSession() {
      const active = await detectAdapters();
      if (active.length === 0) return fail('No AI coding tool data found. Works with Claude Code and Cline.');
    
      const sessions = await Promise.allSettled(active.map(a => a.getCurrentSession()));
      const found = sessions
        .map(r => r.status === 'fulfilled' ? r.value : null)
        .filter(s => s !== null);
    
      if (found.length === 0) return fail('No active session data found.');
    
      const total = found.reduce((s, x) => s + x.cost, 0);
      const lines = [
        'Local Session Costs',
        '\u2500'.repeat(25),
        `${found.length} source(s), $${total.toFixed(4)} total`,
        '',
      ];
    
      for (const s of found) {
        const tokens = s.inputTokens + s.outputTokens;
        lines.push(`${s.source}: $${s.cost.toFixed(4)} (${s.messages} msgs, ${(tokens / 1000).toFixed(0)}k tokens, ${s.topModel})`);
      }
  • Registration of llmkit_local_session in the handler map in packages/mcp-server/src/tools.ts.
    llmkit_local_session: () => handleLocalSession(),
Behavior4/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

Annotations already indicate read-only, non-destructive, and idempotent behavior, which the description doesn't repeat. However, it adds valuable context: 'No API key needed' clarifies authentication requirements, and 'across all detected AI coding tools' specifies the data scope. This enhances transparency beyond the annotations, though it could mention rate limits or data freshness.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is extremely concise and front-loaded: a single sentence that directly states the tool's purpose and key condition ('No API key needed'). Every word earns its place, with no redundant information or fluff.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool's simplicity (0 parameters, annotations covering safety, and an output schema), the description is reasonably complete. It explains what the tool does and adds authentication context. However, it could be more comprehensive by clarifying the output format or differentiating from siblings, though the output schema mitigates the need for return value details.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The tool has 0 parameters, with 100% schema description coverage (empty schema). The description doesn't need to explain parameters, so it appropriately focuses on the tool's function. It adds semantic context by specifying the cost is for 'session' and 'detected AI coding tools', which is helpful given the lack of parameters.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool's purpose: retrieving 'current session cost across all detected AI coding tools (Claude Code, Cline)'. It specifies the resource (session cost) and scope (detected tools), though it doesn't explicitly differentiate from sibling tools like 'llmkit_session_summary' or 'llmkit_cost_query', which might offer similar cost-related data.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides minimal guidance: it mentions 'No API key needed', which is a usage condition, but offers no explicit advice on when to use this tool versus alternatives like 'llmkit_cost_query' or 'llmkit_session_summary'. There's no context on prerequisites, timing, or comparisons to siblings.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

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