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

dsh-mcp-server-clangd

by Rcyc-1025

clangd_diagnostics

Read-only

Fetches clangd diagnostics for a C/C++ source file, returning errors, warnings, hints, or pending results when diagnostics are not ready before the wait timeout.

Instructions

获取某个文件的 clangd 诊断(错误/警告/提示)。会先 didOpen/didChange 再等待 publishDiagnostics 推送;waitMs 超时则返回 pending=true 与已缓存的诊断。

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

Input Schema

NameRequiredDescriptionDefault
fileYes源文件路径:绝对路径,或相对 projectRoot 的路径
waitMsNo等待诊断的最长时间,默认 diagnosticsWaitMs
severityNo只返回某一严重级别;缺省返回全部
includeRelatedNo是否包含 relatedInformation,默认 false

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.1.0

TDQS

A4.3/5.0
Behavior5/5

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

Beyond the supplied annotations, the description discloses the LSP synchronization sequence, the wait for publishDiagnostics, and the exact timeout behavior: pending=true together with already cached diagnostics. This provides valuable asynchronous and potential-staleness context; didOpen/didChange describes protocol synchronization and does not contradict readOnlyHint.

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 front-load the purpose and then cover execution and timeout behavior. There is no filler or redundant recitation of every schema field.

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?

The schema and description together provide enough information to invoke this four-parameter diagnostic read correctly, including its important pending-response case. Because there is no output schema, it could still briefly sketch the normal successful result or recommend how to handle pending=true and possibly stale cached diagnostics.

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 the schema already documents all four parameters. The description adds meaningful waitMs semantics beyond the schema by explaining that expiry produces pending=true and cached diagnostics, though it adds no further detail for file, severity, or includeRelated.

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 opening clause precisely states that the tool retrieves clangd diagnostics for a specific file and identifies them as errors, warnings, or hints. This is functionally distinct from the definition, hover, and symbol siblings, but the description does not explicitly contrast itself with any sibling.

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 single-file diagnostic-retrieval context is clear, and the didOpen/didChange sequence indicates that the tool synchronizes the file before awaiting diagnostics. There is no explicit when-not guidance or alternative-tool routing, but the basic conditions for invocation are easy to understand.

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