Skip to main content
Glama

code_stats

Analyze source code to get metrics like lines of code, comments, blank lines, functions, and classes. Supports auto-detection of programming language.

Instructions

Get code statistics: LOC, comments, blank lines, functions, classes.

Parameters:
    code — Source code to analyze.
    language — Programming language (optional, auto-detected if empty).

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
codeYes
languageNo

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes
Behavior3/5

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

The description indicates a read-only analysis of code, which is accurate. However, without annotations, it could benefit from stating that the code is not stored or modified. The current description is adequate but minimal.

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 concise with two sentences plus parameter explanations. Information is front-loaded, and every sentence serves a purpose.

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?

The description covers the input parameters and lists the output statistics. With an output schema present, the agent can infer the return structure. It is complete enough for a straightforward analysis tool.

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 description adds meaning beyond the schema by explaining the code parameter as source code and the language parameter as optional with auto-detection. With 0% schema coverage, this adds significant value.

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 that the tool retrieves code statistics including LOC, comments, blank lines, functions, and classes. This distinguishes it from sibling tools like text_stats or code_complexity.

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?

No explicit guidance on when to use this tool versus alternatives like code_complexity. It mentions language auto-detection but does not specify prerequisites or scenarios where this tool is preferred.

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/scotia1973-bot/api-hub'

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