Skip to main content
Glama
okeefeco

PyEye Server

by okeefeco

trace

Walk the code graph from starting nodes along specified edges to return a deduplicated subgraph of reachable structure, with configurable depth and node limits.

Instructions

Python: Bounded multi-hop BFS traversal — returns a typed Subgraph.

The composition primitive: it walks the follow edges outward from start across multiple hops, deduping by canonical handle, and returns a Subgraph of the reachable structure. Use resolve()/inspect() to obtain canonical handles first, then trace() to see structure across hops (call chains, reverse-import closures, member trees).

Composes the same edge registry as expand; the implemented edges (members, callees, imported_by, subclasses, superclasses, imports, enclosing_scope) are traversed. Any other edge named in follow (deferred reference edges, unknown names) is reported in unsupported_edges rather than silently dropped — a silent drop would falsely read as "no such neighbours".

Response shape — Subgraph::

{ "nodes": { handle: Stub, ... },        # deduped by canonical handle
  "edges": [ {"from": h, "to": h, "kind": edge}, ... ],
  "truncated": bool,                     # a cap cut off reachable nodes
  "truncation_reasons": ["max_depth"?, "max_nodes"?],  # which cap(s) fired
  "unsupported_edges": [ {"edge", "reason", "detail"}, ... ] }

Edges are NOT deduped across kinds; edges to already-visited handles are recorded (so cycles stay visible) but never re-expanded, guaranteeing termination on cyclic graphs. truncated is true ONLY when max_depth or max_nodes cut off reachable handles before natural termination — not merely because a cap was set.

Args: start: One canonical handle, or a list of them, as BFS roots. follow: Edge names to traverse at every hop (e.g. ["members"], ["callees"], ["imported_by"]). project_path: Project root path (default: current directory). max_depth: Maximum hop distance from a root before a node becomes a non-expanded frontier leaf (default 3). max_nodes: Maximum number of distinct nodes in the subgraph; reaching it sets truncated (default 50). stop_when: Optional StopPredicate (exclude_external / module_pattern / exclude_tests); a matching adjacent is a pruned boundary. Roots are never pruned. exclude_external stops at stdlib/site-packages nodes — keeps a trace inside the project (the common callees case).

Returns: A Subgraph dict (plain, JSON-serialisable). Never raises; an unresolvable root simply contributes no node.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
startYes
followYes
project_pathNo.
max_depthNo
max_nodesNo
stop_whenNo

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Behavior5/5

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

With no annotations, the description fully discloses key behaviors: deduping by canonical handle, no silent drops (unsupported edges reported), edges not deduped across kinds, cycle guarantee (never re-expands visited nodes), truncation triggers (max_depth/max_nodes), and that it never raises. This transparency is exceptional.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is fairly long but well-organized into logical sections: summary, composition context, response shape, and parameter details. Every sentence serves a purpose, explaining behavior or constraints. A minor reduction in redundancy could improve conciseness, but it's already efficient for the complexity.

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?

Given the tool has 6 parameters, an output schema, and no annotations, the description covers all critical aspects: input semantics, output format with fields (nodes, edges, truncated, unsupported_edges), edge behaviors, termination guarantees, and error handling (never raises). The output schema exists but the description adds necessary context beyond the raw schema.

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 description coverage is 0%, so the description must carry the entire parameter documentation burden. It does so thoroughly: start accepts a single handle or list; follow lists edge names; project_path defaults to current dir; max_depth and max_nodes have defaults; stop_when is a StopPredicate with examples (exclude_external, module_pattern, exclude_tests). This greatly enriches the bare schema.

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 opens with a clear statement: 'Python: Bounded multi-hop BFS traversal — returns a typed Subgraph.' It then explains its role as a composition primitive distinct from sibling tools like expand and resolve. The verb 'traverses' and resource 'Subgraph' are specific, making the purpose unambiguous.

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 advises using resolve()/inspect() first to get canonical handles, then trace() for structural exploration. It mentions the common callees case and describes stop_when for excluding external packages. While it doesn't explicitly state when not to use, the context is sufficient for an AI agent to decide.

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/okeefeco/pyeye-mcp'

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