Skip to main content
Glama
jgauffin

ts-language-mcp

by jgauffin

calculate_metrics

Analyze TypeScript code quality by calculating cyclomatic complexity and lines of code per function or file. Identify complexity hotspots across a project or in a specific file.

Instructions

Calculate code quality metrics: cyclomatic complexity per function, lines of code per function/file. Identifies complexity hotspots. Omit "file" for project-wide analysis.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
fileNoPath to file (relative to project root). Omit for project-wide analysis.
topNNoNumber of top hotspots to return (default: 20)
Behavior3/5

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

No annotations are provided, so the description must fully disclose behavior. It describes the tool as calculating static code metrics, which implies a read-only operation. It does not discuss performance implications for large projects or whether results are cached. The description adds useful context but lacks depth on side effects or limitations.

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 three sentences long with no wasted words. Key information is front-loaded, and the usage tip is placed naturally at the end.

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 low complexity (2 optional parameters, no output schema, clear context from sibling tool names), the description is nearly complete. It explains metrics computed and parameter usage. A minor gap is not specifying whether the output includes cumulative or per-function data.

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

Parameters3/5

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

Schema description coverage is 100%, so the schema already documents both parameters well. The description adds slight value by reinforcing the tip for the 'file' parameter and implying 'topN' controls the number of hotspots. However, it does not explain the default for 'topN' beyond the schema.

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 the tool calculates code quality metrics, explicitly naming cyclomatic complexity per function and lines of code per function/file. It also mentions identifying complexity hotspots, which distinguishes it from sibling tools like detect_duplication or quality_report.

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 includes a specific usage tip: 'Omit "file" for project-wide analysis.' This clarifies when to omit the file parameter. However, it does not explicitly distinguish when to use this tool versus siblings like quality_report or get_diagnostics.

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/jgauffin/ts-language-mcp'

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