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

dsh-mcp-server-clangd

by Rcyc-1025

clangd_references

Read-onlyIdempotent

Find all references to a C/C++ symbol at a given file, line, and column, with optional declaration inclusion. Returns sorted 1-based locations for navigation and impact analysis.

Instructions

查找符号的全部引用(textDocument/references)。返回按文件/行/列排序的 1-based 位置列表;includeDeclaration 控制是否包含声明本身。

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_references"
  }
}

Input Schema

NameRequiredDescriptionDefault
fileYes源文件路径:绝对路径,或相对 projectRoot 的路径
lineYes1-based 行号
limitNo最多返回多少条引用,默认 maxResults
columnYes1-based 列号(UTF-16)
includeDeclarationNo是否包含声明位置,默认 true

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.1.0

TDQS

A3.8/5.0
Behavior4/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 genuinely useful behavior: results are sorted by file/line/column and coordinates are 1-based, and it explains the includeDeclaration toggle effect.

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?

Two tight sentences: purpose plus LSP method first, then return shape and the one flag whose effect is non-obvious. Nothing is redundant or padded.

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?

There is no output schema, and the description compensates by describing the return value (a 1-based position list sorted by file/line/column). What remains unstated is how the limit default resolves to maxResults and whether unindexed files yield errors, but for a read-only query tool this is largely complete.

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 schema already documents file, line, column, limit and includeDeclaration with defaults. The description only re-states the includeDeclaration semantics and adds the result-ordering detail, which is marginal beyond the schema baseline.

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 (查找符号的全部引用) and even names the underlying LSP method textDocument/references, so the agent knows exactly what is returned. It implicitly separates itself from clangd_definition via the includeDeclaration note, though it never explicitly says 'use clangd_definition to locate the declaration first'.

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 purpose: find all usages of a symbol at a position. There is no explicit when-to-use versus when-not, and no statement of prerequisites such as requiring the file to be indexed by clangd, which matters for an LSP-backed tool.

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