Skip to main content
Glama
dhippley

Azure Topology Graph MCP Server

by dhippley

find_path

Discover connection paths between Azure resources to analyze infrastructure relationships and troubleshoot connectivity issues.

Instructions

Find connection path between two Azure resources

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
sourceIdYesSource resource ID
targetIdYesTarget resource ID

Implementation Reference

  • Core implementation of the find_path tool: performs BFS on the topology graph to find the shortest path between sourceId and targetId Azure resources.
    async function findResourcePath(sourceId: string, targetId: string): Promise<GraphNode[]> {
      const topology = await buildTopology();
      
      if (!topology.nodes.find(n => n.id === sourceId)) {
        throw new McpError(ErrorCode.InvalidRequest, `Source resource not found: ${sourceId}`);
      }
      
      if (!topology.nodes.find(n => n.id === targetId)) {
        throw new McpError(ErrorCode.InvalidRequest, `Target resource not found: ${targetId}`);
      }
      
      // Simple BFS to find shortest path
      const queue: string[][] = [[sourceId]];
      const visited = new Set<string>([sourceId]);
      
      while (queue.length > 0) {
        const path = queue.shift()!;
        const current = path[path.length - 1];
        
        if (current === targetId) {
          return path.map(id => topology.nodes.find(n => n.id === id)!);
        }
        
        // Find neighbors
        for (const edge of topology.edges) {
          let next: string | null = null;
          
          if (edge.source === current && !visited.has(edge.target)) {
            next = edge.target;
          } else if (edge.target === current && !visited.has(edge.source)) {
            next = edge.source;
          }
          
          if (next) {
            visited.add(next);
            queue.push([...path, next]);
          }
        }
      }
      
      return []; // No path found
    }
  • src/server.ts:385-402 (registration)
    Registers the 'find_path' tool in the ListTools response with name, description, and input schema.
    {
      name: 'find_path',
      description: 'Find connection path between two Azure resources',
      inputSchema: {
        type: 'object',
        properties: {
          sourceId: {
            type: 'string',
            description: 'Source resource ID',
          },
          targetId: {
            type: 'string',
            description: 'Target resource ID',
          },
        },
        required: ['sourceId', 'targetId'],
      },
    },
  • MCP CallTool handler for 'find_path': calls findResourcePath and formats success/error responses.
    case 'find_path': {
      const { sourceId, targetId } = args as { sourceId: string; targetId: string };
      const path = await findResourcePath(sourceId, targetId);
      
      if (path.length === 0) {
        return {
          content: [
            {
              type: 'text',
              text: `No connection path found between the specified resources.`,
            },
          ],
        };
      }
      
      return {
        content: [
          {
            type: 'text',
            text: `Connection Path (${path.length} hops):\n\n` +
              path.map((node, index) => 
                `${index + 1}. ${node.name} (${node.type})\n   ${node.id}`
              ).join('\n\n'),
          },
        ],
      };
    }
  • Input schema definition for the 'find_path' tool requiring sourceId and targetId.
    inputSchema: {
      type: 'object',
      properties: {
        sourceId: {
          type: 'string',
          description: 'Source resource ID',
        },
        targetId: {
          type: 'string',
          description: 'Target resource ID',
        },
      },
      required: ['sourceId', 'targetId'],
    },
Behavior2/5

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

No annotations are provided, so the description carries the full burden of behavioral disclosure. It states the tool finds a 'connection path,' but doesn't explain what constitutes a connection (e.g., network links, dependencies), whether it returns multiple paths or just one, performance characteristics, or error conditions. For a path-finding tool with zero annotation coverage, this is a significant gap in transparency.

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 a single, efficient sentence: 'Find connection path between two Azure resources.' It's front-loaded with the core purpose, has zero wasted words, and is appropriately sized for a tool with two straightforward parameters. Every word earns its place.

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

Completeness2/5

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

Given the complexity of path-finding in Azure resources, no annotations, and no output schema, the description is incomplete. It doesn't explain what a 'connection path' entails, the return format, or behavioral aspects like whether it's a read-only operation. For a tool that likely involves graph traversal or dependency analysis, more context is needed to guide effective use.

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

Parameters3/5

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

Schema description coverage is 100%, with both parameters ('sourceId' and 'targetId') clearly documented in the schema as 'Source resource ID' and 'Target resource ID.' The description adds no additional parameter semantics beyond what the schema provides, such as format examples or constraints. Baseline 3 is appropriate when the schema does the heavy lifting.

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

Purpose4/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: 'Find connection path between two Azure resources.' It specifies the verb ('Find'), resource type ('Azure resources'), and scope ('connection path between two'). However, it doesn't explicitly differentiate from sibling tools like 'get_neighbors' or 'export_topology' which might also involve resource relationships.

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

Usage Guidelines2/5

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

The description provides no guidance on when to use this tool versus alternatives. It doesn't mention prerequisites, context for when path-finding is needed, or comparisons to siblings like 'get_neighbors' (which might show direct connections) or 'search_resources' (which might help identify resources). Usage is implied but not explicitly stated.

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/dhippley/azure_mcp_graph'

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