Skip to main content
Glama
GraphiteAI

graphite-mcp

Official
by GraphiteAI

find_path

Find the relationship chain connecting two companies or entities in the financial knowledge graph, showing intermediate connections up to a specified depth.

Instructions

Find how two companies/entities are connected through the knowledge graph. Shows the chain of relationships. Example: find_path(source='company:AAPL', target='company:TSM')

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
sourceYesSource entity ID
targetYesTarget entity ID
max_depthNoMax hops (default 6)

Implementation Reference

  • Input schema for the 'find_path' tool: requires source and target entity IDs, with optional max_depth (default 6).
    Tool(
        name="find_path",
        description="Find how two companies/entities are connected through the knowledge graph. Shows the chain of relationships. Example: find_path(source='company:AAPL', target='company:TSM')",
        inputSchema={
            "type": "object",
            "properties": {
                "source": {"type": "string", "description": "Source entity ID"},
                "target": {"type": "string", "description": "Target entity ID"},
                "max_depth": {"type": "integer", "description": "Max hops (default 6)", "default": 6},
            },
            "required": ["source", "target"],
        },
    ),
  • Handler for 'find_path' tool: calls GET /api/v1/graph/path with source, target, and max_depth parameters via the central REST API.
    elif name == "find_path":
        result = await _get("/graph/path", params={
            "source": arguments["source"],
            "target": arguments["target"],
            "max_depth": arguments.get("max_depth", 6),
        })
  • Tool registration: the 'find_path' tool is registered in the list_tools() function (line 98) returned by the @server.list_tools() decorator.
    @server.list_tools()
    async def list_tools() -> list[Tool]:
        return [
            Tool(
                name="search_entities",
                description="Search the financial knowledge graph for companies, people, patents by name, ticker, or description. Example: search_entities(query='NVIDIA') or search_entities(query='semiconductor', sector='semiconductors')",
                inputSchema={
                    "type": "object",
                    "properties": {
                        "query": {"type": "string", "description": "Search query (name, ticker, or keyword)"},
                        "entity_type": {"type": "string", "description": "Filter by type", "enum": ["company", "person", "patent", "product", "regulation", "event"]},
                        "sector": {"type": "string", "description": "Filter by sector: semiconductors, software, pharma, etc."},
                        "limit": {"type": "integer", "description": "Max results (default 20)", "default": 20},
                    },
                    "required": ["query"],
                },
            ),
            Tool(
                name="get_entity",
                description="Get detailed information about a specific entity by ID. Example: get_entity(entity_id='company:NVDA')",
                inputSchema={
                    "type": "object",
                    "properties": {
                        "entity_id": {"type": "string", "description": "Entity ID, e.g. 'company:AAPL', 'person:TIM_COOK_AAPL'"},
                    },
                    "required": ["entity_id"],
                },
            ),
            Tool(
                name="get_relationships",
                description="Get all relationships for an entity — suppliers, competitors, partners, dependencies, etc. Example: get_relationships(entity_id='company:NVDA')",
                inputSchema={
                    "type": "object",
                    "properties": {
                        "entity_id": {"type": "string", "description": "Entity ID"},
                    },
                    "required": ["entity_id"],
                },
            ),
            Tool(
                name="get_facts",
                description="Get known facts about an entity — revenue, employee count, etc. Example: get_facts(entity_id='company:AAPL')",
                inputSchema={
                    "type": "object",
                    "properties": {
                        "entity_id": {"type": "string", "description": "Entity ID"},
                    },
                    "required": ["entity_id"],
                },
            ),
            Tool(
                name="find_path",
                description="Find how two companies/entities are connected through the knowledge graph. Shows the chain of relationships. Example: find_path(source='company:AAPL', target='company:TSM')",
                inputSchema={
                    "type": "object",
                    "properties": {
                        "source": {"type": "string", "description": "Source entity ID"},
                        "target": {"type": "string", "description": "Target entity ID"},
                        "max_depth": {"type": "integer", "description": "Max hops (default 6)", "default": 6},
                    },
                    "required": ["source", "target"],
                },
            ),
            Tool(
                name="exposure_analysis",
                description="Analyze a company's exposure: 1st and 2nd degree connections, sector concentration, dependency risks. Example: exposure_analysis(entity_id='company:TSM')",
                inputSchema={
                    "type": "object",
                    "properties": {
                        "entity_id": {"type": "string", "description": "Entity ID to analyze"},
                    },
                    "required": ["entity_id"],
                },
            ),
            Tool(
                name="compare_entities",
                description="Compare two entities: shared connections, direct relationships, path distance. Example: compare_entities(entity_a='company:NVDA', entity_b='company:AMD')",
                inputSchema={
                    "type": "object",
                    "properties": {
                        "entity_a": {"type": "string", "description": "First entity ID"},
                        "entity_b": {"type": "string", "description": "Second entity ID"},
                    },
                    "required": ["entity_a", "entity_b"],
                },
            ),
        ]
Behavior3/5

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

With no annotations, description carries burden of behavioral disclosure. It mentions max_depth and that it shows a chain, but lacks details on side effects, read-only nature, or output structure. Basic transparency but incomplete.

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?

Extremely concise: two sentences plus example. Front-loaded with purpose. No redundant information.

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

Completeness3/5

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

No output schema; description only vaguely says 'shows the chain of relationships'. Missing details on return format, pagination, or constraints. Adequate for simple use but incomplete for complex scenarios.

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 covers all parameters (100% coverage). Description adds value by showing example with specific entity IDs ('company:AAPL'), clarifying the ID format beyond generic 'Source entity ID'.

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?

Description clearly states the tool finds connections between two entities in the knowledge graph, mentions 'chain of relationships', and provides a concrete example. It distinguishes from siblings like get_entity or search_entities by focusing on path discovery.

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

Usage Guidelines3/5

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

Description implies usage when needing to understand how two entities are related, but does not explicitly state when to use this tool over siblings or provide 'when not to use' 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/GraphiteAI/graphite-mcp'

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