Skip to main content
Glama
dsh-mcp-server-clangd

dsh-mcp-server-clangd

by Rcyc-1025

clangd_definition

Read-onlyIdempotent

Finds the C/C++ symbol definition at a given file, line, and column, returning the defining file and selection range for precise code navigation.

Instructions

查询某个位置符号的定义(textDocument/definition)。输入 file(绝对路径或相对 projectRoot)、1-based line/column;返回定义所在文件与选区范围(1-based,end exclusive)。

Tool call template

Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {
      "file": "<file>",
      "line": "<line>",
      "column": "<column>"
    },
    "name": "clangd_definition"
  }
}

Input Schema

NameRequiredDescriptionDefault
fileYes源文件路径:绝对路径,或相对 projectRoot 的路径
lineYes1-based 行号
limitNo最多返回多少条定义,默认 maxResults
columnYes1-based 列号(UTF-16)

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.1.0

TDQS

A3.5/5.0
Behavior3/5

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

Annotations already declare readOnlyHint, idempotentHint and openWorldHint=false, so the safety profile is covered. The description adds value by disclosing the return shape (file plus selection range, 1-based with exclusive end), but says nothing about behavior when no definition is found or about the limit/default-maxResults truncation semantics.

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?

A single compact sentence with the action front-loaded and return semantics appended; no wasted clauses. Minor density cost from packing LSP method name, input format and output range into one line.

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?

With no output schema, the description usefully compensates by explaining the return value and its 1-based, end-exclusive range convention. For a simple 4-parameter lookup tool this is close to complete, with only empty-result behavior left unaddressed.

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 coverage is 100%, so the baseline applies; the description largely restates the schema's file and 1-based line/column semantics. It adds no meaning for the limit parameter or the relationship between limit and the default maxResults.

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?

States a specific verb and resource: query the definition of a symbol at a position, and even names the underlying LSP method (textDocument/definition). It does not explicitly contrast with siblings such as clangd_references or clangd_hover, so an agent must rely on the LSP method name to differentiate.

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

Usage Guidelines3/5

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

Usage is only implied by the semantics of 'definition' versus siblings like references; there is no explicit when-to-use, when-not-to-use, or alternative-routing guidance. The mention of file/line/column prerequisites is incidental rather than framed as guidance.

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