Skip to main content
Glama
dhippley

Azure Topology Graph MCP Server

by dhippley

export_topology

Export Azure infrastructure topology graphs in JSON or summary format to analyze resource relationships and connectivity paths.

Instructions

Export the complete topology graph

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
formatNoExport formatsummary

Implementation Reference

  • Handler function that implements the export_topology tool logic. It builds the topology and returns either full JSON or a summary based on the format parameter.
    case 'export_topology': {
      const { format = 'summary' } = args as { format?: 'json' | 'summary' };
      const topology = await buildTopology();
      
      if (format === 'json') {
        return {
          content: [
            {
              type: 'text',
              text: JSON.stringify(topology, null, 2),
            },
          ],
        };
      } else {
        const resourceTypes = Array.from(new Set(topology.nodes.map(n => n.type))).sort();
        const subscriptions = Array.from(new Set(topology.nodes.map(n => n.subscriptionId))).sort();
        const resourceGroups = Array.from(new Set(topology.nodes.map(n => n.resourceGroup))).sort();
        
        return {
          content: [
            {
              type: 'text',
              text: `Azure Topology Summary:\n\n` +
                `Total Resources: ${topology.nodes.length}\n` +
                `Total Connections: ${topology.edges.length}\n\n` +
                `Subscriptions (${subscriptions.length}):\n${subscriptions.map(s => `• ${s}`).join('\n')}\n\n` +
                `Resource Groups (${resourceGroups.length}):\n${resourceGroups.map(rg => `• ${rg}`).join('\n')}\n\n` +
                `Resource Types (${resourceTypes.length}):\n${resourceTypes.map(rt => `• ${rt}`).join('\n')}`,
            },
          ],
        };
      }
    }
  • Input schema for the export_topology tool, defining the optional format parameter.
    inputSchema: {
      type: 'object',
      properties: {
        format: {
          type: 'string',
          enum: ['json', 'summary'],
          description: 'Export format',
          default: 'summary',
        },
      },
    },
  • src/server.ts:404-417 (registration)
    Registration of the export_topology tool in the tools list returned by ListToolsRequestHandler.
      name: 'export_topology',
      description: 'Export the complete topology graph',
      inputSchema: {
        type: 'object',
        properties: {
          format: {
            type: 'string',
            enum: ['json', 'summary'],
            description: 'Export format',
            default: 'summary',
          },
        },
      },
    },
  • Key helper function called by the handler to build and cache the topology graph from Azure Resource Graph queries.
    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;
      }
    }
Behavior2/5

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

With no annotations provided, the description carries full burden for behavioral disclosure. 'Export' implies a read operation that generates output, but it doesn't specify whether this is a heavy operation, whether it requires specific permissions, what the output format entails beyond the parameter options, or if there are rate limits. The description adds minimal behavioral context beyond the basic action.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, efficient sentence with no wasted words. It's front-loaded with the core action and resource. However, it could be slightly more informative without sacrificing conciseness, such as hinting at the output's purpose.

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?

For a tool with no annotations and no output schema, the description is incomplete. It doesn't explain what the exported topology graph contains, how it's structured, or what 'complete' means. Given the complexity implied by 'topology graph' and lack of structured data, more context is needed for the agent to use this effectively.

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?

The input schema has 100% description coverage, with the single parameter 'format' clearly documented with enum values and default. The description doesn't add any parameter semantics beyond what the schema provides, such as explaining what 'json' versus 'summary' formats entail. 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.

Purpose3/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description 'Export the complete topology graph' clearly states the action (export) and resource (topology graph), but it's somewhat vague about what 'complete' means in this context. It distinguishes from siblings like 'find_path' or 'get_neighbors' by focusing on export rather than querying, but doesn't explicitly differentiate from 'refresh_topology' which might also involve topology operations.

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 like 'refresh_topology' or 'search_resources'. There's no mention of prerequisites, use cases, or exclusions. The agent must infer usage from the tool name and description alone.

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