Skip to main content
Glama
dhippley

Azure Topology Graph MCP Server

by dhippley

get_resource

Retrieve detailed information about any Azure resource using its full resource ID to understand resource properties and configuration.

Instructions

Get detailed information about a specific Azure resource

Input Schema

NameRequiredDescriptionDefault
resourceIdYesFull Azure resource ID

Input Schema (JSON Schema)

{ "properties": { "resourceId": { "description": "Full Azure resource ID", "type": "string" } }, "required": [ "resourceId" ], "type": "object" }

Implementation Reference

  • Handler for the 'get_resource' tool. Retrieves and formats details of a specific Azure resource by its full resource ID from the topology graph.
    case 'get_resource': { const { resourceId } = args as { resourceId: string }; const topology = await buildTopology(); const resource = topology.nodes.find(n => n.id === resourceId); if (!resource) { throw new McpError(ErrorCode.InvalidRequest, `Resource not found: ${resourceId}`); } return { content: [ { type: 'text', text: `Resource Details:\n\n` + `Name: ${resource.name}\n` + `Type: ${resource.type}\n` + `Resource Group: ${resource.resourceGroup}\n` + `Location: ${resource.location}\n` + `Subscription: ${resource.subscriptionId}\n` + `ID: ${resource.id}\n\n` + (resource.tags ? `Tags: ${JSON.stringify(resource.tags, null, 2)}\n\n` : '') + (resource.properties ? `Properties: ${JSON.stringify(resource.properties, null, 2)}` : ''), }, ], }; }
  • src/server.ts:358-370 (registration)
    Tool registration in the list tools response, defining name, description, and input schema for 'get_resource'.
    name: 'get_resource', description: 'Get detailed information about a specific Azure resource', inputSchema: { type: 'object', properties: { resourceId: { type: 'string', description: 'Full Azure resource ID', }, }, required: ['resourceId'], }, },
  • Input schema definition for the 'get_resource' tool, specifying the required 'resourceId' parameter.
    type: 'object', properties: { resourceId: { type: 'string', description: 'Full Azure resource ID', }, }, required: ['resourceId'], },
  • Helper function buildTopology() that constructs the resource topology graph from Azure Resource Graph queries, cached for 5 minutes, and used by the get_resource handler to find the resource node.
    async function buildTopology(): Promise<TopologyGraph> { const now = Date.now(); if (topologyCache && (now - cacheTimestamp) < CACHE_TTL) { return topologyCache; } console.error('Building topology from Azure resources...'); try { // Query all resources const resourcesResult = await resourceGraphClient.resources({ query: RESOURCE_QUERY, subscriptions: subscriptionIds, }); const nodes: GraphNode[] = []; const edges: GraphEdge[] = []; // Process resources into nodes if (resourcesResult.data) { for (const resource of resourcesResult.data as any[]) { const node: GraphNode = { id: resource.id, type: resource.type, name: resource.name, subscriptionId: resource.subscriptionId, resourceGroup: resource.resourceGroup, location: resource.location, tags: resource.tags, properties: resource.properties, }; nodes.push(node); } } // Build relationships/edges await buildResourceRelationships(nodes, edges); const topology: TopologyGraph = { nodes, edges }; topologyCache = topology; cacheTimestamp = now; console.error(`Topology built: ${nodes.length} nodes, ${edges.length} edges`); return topology; } catch (error) { console.error('Error building topology:', error); throw error; } }

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