Skip to main content
Glama

cost-session

Calculate the cost of a specific Claude Code session or automatically detect the active session from recent files.

Instructions

Custo Claude Code de uma sessão específica (ou da sessão ativa auto-deduzida pelo arquivo JSONL mais recente com mtime < 30min). Retorna shape canônico + session_id, started_at, last_activity_at, source_file. Triggers: "custo da sessão", "session cost", "quanto essa conversa gastou", "current session usd". Use cost-today para o dia inteiro.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
session_idNoUUID da sessão. Omita para auto-deduzir a sessão ativa.
transcript_pathNoPath do arquivo JSONL (basename sem .jsonl = session_id). Alternativa a session_id.
config_dirsNo
max_idle_msNoJanela de inatividade para considerar sessão ativa (auto-deduce). Default: 1800000 (30min).
refresh_pricingNo
persistNo
projectRootNo
Behavior3/5

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

No annotations are provided, so the description carries the full burden. It discloses auto-deduction and return fields but does not state side effects (e.g., read-only, auth needs, rate limits). The tool appears to be a read operation, but behavioral details are incomplete given the lack of annotations.

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

Conciseness3/5

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

The description is a few lines with trigger phrases, which is adequate but not highly structured. It could be more concise by omitting trigger phrases (which are not standard for tool descriptions) or integrating them more cleanly. Overall, acceptable length but room for improvement.

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

Completeness2/5

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

Given 7 parameters, no output schema, and no annotations, the description should be more comprehensive. It lacks explanations for most parameters, does not describe the exact return structure beyond 'canonical shape', and omits error handling or edge cases. The description is incomplete for a tool of this complexity.

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

Parameters2/5

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

Schema description coverage is only 43%, and the description does not compensate. It adds context only for max_idle_ms (the 30-minute window) but fails to explain config_dirs, refresh_pricing, persist, or projectRoot. Most parameters remain undocumented in the description, leaving a gap.

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

Purpose5/5

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

The description clearly states it returns the cost of a specific (or auto-deduced active) session, lists the returned fields (canonical shape, session_id, etc.), and distinguishes from sibling cost-today by explicitly directing to use that tool for daily totals. The trigger phrases further clarify purpose.

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

Usage Guidelines4/5

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

The description explains when to use (for session cost) and explicitly names an alternative (cost-today for entire day). It also describes the auto-deduction logic based on recent JSONL file mtime, giving clear context. No explicit 'when not to use' but the alternative serves as exclusion.

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/luanpdd/kit-mcp'

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