Skip to main content
Glama
Chia1104

tsserver-mcp-server

by Chia1104

get_definition

Find the definition location of a symbol at a cursor position in TypeScript/JavaScript code. Provide file path, content, line, and offset to get the symbol's definition file and coordinates.

Instructions

Get the definition location of the symbol at the cursor (Go to Definition)

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
lineYesCursor line (1-based)
offsetYesCursor column (1-based)
filePathYesFile path (absolute or relative to project root)
fileContentYesFile content (TypeScript/JavaScript source code)
projectPathNoProject root (directory with node_modules/tsconfig). When set, the server reads project files from disk so imports (e.g. zod) and cross-file features work.
Behavior2/5

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

With no annotations, the description must disclose behavioral traits. It only says 'get definition location' without explaining whether it reads from fileContent, requires projectPath for cross-file definitions, or what the return format is (e.g., range, URI). The optional projectPath parameter hints at behavior, but the description itself adds minimal transparency.

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

Conciseness4/5

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

The description is a single, clear sentence with no redundant wording. It is concise and front-loaded with the core action. However, it may be too terse given the tool's complexity, yet it earns its place by stating the essential purpose.

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?

Without an output schema, the description should at least mention the result type (e.g., location/range) and whether cross-file resolution requires projectPath. It also doesn't differentiate from get_type_definition or clarify when the cursor-based approach is appropriate. The tool has moderate complexity and sibling tools, so more context is needed.

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?

The input schema provides detailed descriptions for all five parameters (line, offset, filePath, fileContent, projectPath), so coverage is 100%. The description adds no extra parameter semantics, but the schema already explains the meaning and purpose of each field, including the optional projectPath behavior.

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 action ('Get the definition location') and the target ('the symbol at the cursor'), including the familiar 'Go to Definition' phrase. It is distinct from sibling get_type_definition by emphasizing definition location rather than type definition, though it doesn't explicitly call out that distinction.

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 guidance is provided on when to use this tool versus siblings like get_type_definition or get_references. The description implies it is for navigating to a symbol's definition at the cursor position, but there are no explicit use-case instructions or exclusions.

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/Chia1104/tsserver-mcp-server'

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