Skip to main content
Glama

cos_graph_query

Read-onlyIdempotent

Look up a symbol by its short term, path, or UID in a code graph. Returns matching nodes with optional filters and expansion.

Instructions

Look up a symbol by a KNOWN short term, path, or uid (lexical + graph expansion). For a natural-language DESCRIPTION of code whose name you don't know, use cos_graph_search instead.

TIP: prefer SHORT terms ("sdk_dispatcher", "ClaudeSDKDispatcher.dispatch") or a literal path / uid. Long natural-language queries return weaker matches because the index is built from labels + docstrings, not free text.

UID scheme (also accepted as q): code:file: · code:function::: · code:class::: code:method:::. · code:module: doc:file: · doc:heading:#: · folder:

When the query looks like a path or uid and the lexical pass returns nothing, the tool falls back to a direct uid lookup so the agent gets a single-item hit instead of empty results.

Args: q: Short term, path, or uid (non-empty). NL queries work but degrade. kinds: Comma-separated filter of node kinds (e.g. "function,class,method"). Empty = all. limit: Max results (default 10). max_hops: Walk expansion depth (default 2). confidence_min: Edge confidence floor (default 0.3). include_spine: S3 — attach the CONTAINS-ancestor chain to each result for breadcrumbs.

Returns: JSON envelope with results array. See docs/engineering/graph_os-queries.md.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
qYes
kindsNo
limitNo
max_hopsNo
include_spineNo
confidence_minNo

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes
Behavior5/5

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

Beyond annotations (readOnly, idempotent, non-destructive), the description discloses that the tool performs lexical + graph expansion, falls back to direct uid lookup when lexical pass returns nothing, and returns weaker matches for long natural-language queries due to index limitations. This adds meaningful behavioral context.

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?

The description is structured with purpose, alternative, tip, UID scheme, fallback behavior, and args. Although long, each section serves a distinct purpose and no sentence is wasted; the 'S3' typo is a minor blemish but doesn't detract.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness5/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a 6-param tool with output schema, the description covers query semantics, UID formats, fallback behavior, parameter meanings, and return envelope. It also references external docs for deeper details. This is adequate for correct invocation.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters5/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema has 0% description coverage, but the description's Args section fully specifies all 6 parameters with types, examples (e.g., kinds comma-separated), and behavioral notes (e.g., NL queries degrade). This fully compensates for the schema gap.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool looks up symbols by a KNOWN short term, path, or uid, with a specific verb and resource. It explicitly distinguishes itself from cos_graph_search, which handles natural-language descriptions. The UID scheme adds further precision.

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

Usage Guidelines5/5

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

The description explicitly says when to use this tool (known term/path/uid) and when not to (natural-language descriptions, use cos_graph_search instead). It also provides a TIP about preferring short terms and explains the trade-off with long NL queries. This is clear when/when-not guidance.

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/kouroshez/coding-os'

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