Skip to main content
Glama
dhippley

Azure Topology Graph MCP Server

by dhippley

get_neighbors

Find connected resources in Azure infrastructure to analyze relationships and dependencies for troubleshooting or optimization.

Instructions

Get resources connected to a specific resource

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
resourceIdYesFull Azure resource ID

Implementation Reference

  • Core handler function that retrieves the specified resource node and all directly connected neighbor nodes from the cached topology graph by scanning edges.
    async function getResourceNeighbors(resourceId: string): Promise<{node: GraphNode, neighbors: GraphNode[]}> { const topology = await buildTopology(); const node = topology.nodes.find(n => n.id === resourceId); if (!node) { throw new McpError(ErrorCode.InvalidRequest, `Resource not found: ${resourceId}`); } // Find all connected nodes const connectedIds = new Set<string>(); for (const edge of topology.edges) { if (edge.source === resourceId) { connectedIds.add(edge.target); } else if (edge.target === resourceId) { connectedIds.add(edge.source); } } const neighbors = topology.nodes.filter(n => connectedIds.has(n.id)); return { node, neighbors };
  • src/server.ts:371-384 (registration)
    Tool registration entry in the ListTools response, including name, description, and input schema.
    { name: 'get_neighbors', description: 'Get resources connected to a specific resource', inputSchema: { type: 'object', properties: { resourceId: { type: 'string', description: 'Full Azure resource ID', }, }, required: ['resourceId'], }, },
  • Dispatch handler in the CallToolRequestHandler switch statement that extracts arguments, calls the core getResourceNeighbors function, and formats the textual response.
    case 'get_neighbors': { const { resourceId } = args as { resourceId: string }; const { node, neighbors } = await getResourceNeighbors(resourceId); return { content: [ { type: 'text', text: `Resource: ${node.name} (${node.type})\n\n` + `Connected Resources (${neighbors.length}):\n\n` + neighbors.map(n => `• ${n.name} (${n.type})\n Resource Group: ${n.resourceGroup}\n Location: ${n.location}` ).join('\n\n'), }, ], }; }

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