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

dsh-mcp-server-clangd

by Rcyc-1025

clangd_document_symbols

Read-onlyIdempotent

Retrieve a hierarchical symbol outline for a single C/C++ source file, preserving parent-child relationships and flagging truncated results when the node limit is exceeded.

Instructions

获取单个文件内的符号大纲(textDocument/documentSymbol)。clangd 返回层次结构时保留父子关系;超过 limit 时按 DFS 截断并标记 truncated。

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>"
    },
    "name": "clangd_document_symbols"
  }
}

Input Schema

NameRequiredDescriptionDefault
fileYes源文件路径:绝对路径,或相对 projectRoot 的路径
limitNo最多返回多少个符号节点(含子节点),默认 maxResults

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.1.0

TDQS

A3.9/5.0
Behavior4/5

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

Annotations already establish readOnly/idempotent/closed-world, but the description adds genuinely new behavior: hierarchy preservation of parent-child nodes, DFS-order truncation past the limit, and a 'truncated' marker so the caller knows results were clipped. It does not say what happens with unparseable/unsupported files, which is the only notable behavioral gap.

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 compact sentences plus a clause, with the purpose front-loaded and behavioral details following in priority order. Every clause carries information the schema and annotations do not.

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?

For a two-parameter read-only LSP wrapper with no output schema, the definition covers purpose, structure of the returned tree, and truncation semantics well. It stops short of noting that results depend on clangd's parse state/index being available.

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?

Schema description coverage is 100%, so baseline is 3; the description nonetheless adds meaning to `limit` by explaining how clipping is applied (DFS traversal) and how the caller can detect it (truncated flag). It adds nothing about `file` path resolution beyond what the schema's own description already states.

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?

Description names a specific verb and resource ('获取单个文件内的符号大纲') plus the underlying LSP method (textDocument/documentSymbol), and the '单个文件' scoping implicitly separates it from clangd_workspace_symbols. It never names the sibling explicitly, so an agent must infer the contrast rather than being told.

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 single-file scope: use this when you want an outline of one file. There is no explicit 'use X instead when Y' guidance against clangd_workspace_symbols or clangd_hover, and no stated prerequisites such as requiring an open/indexed file.

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