Skip to main content
Glama
dhippley

Azure Topology Graph MCP Server

by dhippley

find_path

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

Instructions

Find connection path between two Azure resources

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
sourceIdYesSource resource ID
targetIdYesTarget resource ID

Implementation Reference

  • MCP tool dispatcher case for 'find_path' tool. Parses arguments, calls the path-finding function, handles no-path case, and formats the response content.
    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'), }, ], }; }
  • Core implementation of the find_path tool using BFS to find the shortest path between two resources in the topology graph.
    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)
    Registration of the 'find_path' tool in the listTools response, including name, description, and input schema definition.
    { 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'], }, },
  • Input schema definition for the 'find_path' tool specifying sourceId and targetId parameters.
    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