Skip to main content
Glama

query_subgraph

Extract a self-contained local subgraph around seed IDs from a session's Knowledge Structure, with filters and budget caps for targeted exploration.

Instructions

Extract the local k‑hop neighbourhood around one or more seed ids from a session's current Knowledge Structure. Returns a self‑contained subgraph (serialized) and metadata: total_found_nodes, returned_nodes, is_truncated, truncation_reason, suggested_next_seed. Use filters (include_relation_types, include_object_types) to narrow the traversal, and max_tokens/max_objects to cap the result. type_weights can prioritise certain object types when the budget forces truncation.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
depthNoMaximum hops from any seed. Default 1.
seed_idsNoList of object ids to start traversal from.
max_tokensNoOptional token budget (approx).
session_idYesThe session whose Knowledge Structure to query.
max_objectsNoOptional hard cap on total objects returned.
compact_modeNoIf true, return a compact representation (nodes + edges) instead of full canonical JSON.
type_weightsNoOptional mapping of object type to weight (float), used in budget ranking.
structure_filtersNoOptional. AND-filter applied to non-relation objects after extraction: only objects whose 'structure' dict contains ALL key=value pairs survive. Seed objects are always kept regardless. Relations are retained when both their participants survive the filter. Example: {"status": "active", "domain": "biology"}.
include_object_typesNoOptional. Only include discovered objects of these types (seeds always kept).
include_relation_typesNoOptional. Only traverse/include these relation types.
Behavior5/5

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

With no annotations provided, the description carries the full burden of behavioral disclosure. It discloses the return format (self-contained subgraph, serialized), metadata fields (total_found_nodes, returned_nodes, is_truncated, truncation_reason, suggested_next_seed), and behavior around truncation and budget prioritization via type_weights. This is rich, beyond what a typical description offers.

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 four sentences, tightly packed with useful information. It front-loads the main purpose in the first sentence, then systematically covers return metadata, filtering, and budget handling. No filler or redundancy.

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 complex tool with 10 parameters and no output schema, the description covers the essential behavior: what is returned, truncation metadata, and how to control the traversal. The schema handles the remaining parameter details, and the description explicitly lists the metadata fields, making the output understandable without an output schema.

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?

The input schema already covers all 10 parameters with descriptions (100% coverage), so the baseline is 3. The description adds strategic guidance on how parameters interact: filters narrow traversal, max_tokens/max_objects cap the result, and type_weights prioritize when truncation occurs. This adds meaning beyond the schema's simple per-parameter descriptions.

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's purpose: 'Extract the local k-hop neighbourhood around one or more seed ids from a session's current Knowledge Structure.' It uses a specific verb ('extract') and resource ('session's Knowledge Structure'), and the mention of 'k-hop neighbourhood' distinguishes it from sibling tools like search_semantic or serialize_knowledge.

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 description provides clear usage context: it explains how to narrow traversal with filters and cap results with max_tokens/max_objects. However, it does not explicitly mention when to use this tool versus alternatives or state any exclusions, so it lacks explicit sibling differentiation.

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/Deus-corp/cks-mcp'

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