get_relationship_graph
Retrieve the complete relationship graph for ERC-8004 AI agents, with optional filtering by minimum number of connections to exclude sparse nodes.
Instructions
Return the full set of relationships as a graph.
Args: min_connections: Filter out agents with fewer than this many relationships from the returned edge list (default 0 = no filter).
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| min_connections | No |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/minuet_mcp/server.py:102-128 (handler)The async function `get_relationship_graph` is decorated with @mcp.tool() and implements the tool logic: it calls MinuetClient.list_relationships(), optionally filters relationships by min_connections (using Counter to exclude agents with fewer relationships), and returns the count and list of relationships.
@mcp.tool() async def get_relationship_graph(min_connections: int = 0) -> dict[str, Any]: """Return the full set of relationships as a graph. Args: min_connections: Filter out agents with fewer than this many relationships from the returned edge list (default 0 = no filter). """ async with MinuetClient() as client: data = await client.list_relationships() relationships = data.get("relationships", []) if min_connections > 0: from collections import Counter counts: Counter[str] = Counter() for r in relationships: counts[r.get("from_agent", "")] += 1 counts[r.get("to_agent", "")] += 1 relationships = [ r for r in relationships if counts[r.get("from_agent", "")] >= min_connections and counts[r.get("to_agent", "")] >= min_connections ] return {"count": len(relationships), "relationships": relationships} - src/minuet_mcp/server.py:16-16 (registration)The FastMCP instance `mcp` is created here. The @mcp.tool() decorator on line 102 registers 'get_relationship_graph' as an MCP tool.
mcp = FastMCP("minuet-mcp") - src/minuet_mcp/server.py:14-14 (helper)MinuetClient is imported from .client and is the HTTP client used by the handler to call the Minuet API endpoint /api/relationships.
from .client import MinuetClient - src/minuet_mcp/client.py:99-100 (helper)The `list_relationships` method on MinuetClient fetches the full relationship data from /api/relationships, which is what get_relationship_graph uses.
async def list_relationships(self) -> dict[str, Any]: return await self._get("/api/relationships") - tests/test_stdio_protocol.py:89-89 (registration)The tool name appears in the EXPECTED_TOOLS set in the test file, confirming it is expected to be registered.
"get_relationship_graph",