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'], },

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