Skip to main content
Glama

get-resource-details

Retrieve detailed information about Azure resources by providing their resource ID to manage and monitor cloud infrastructure.

Instructions

Get detailed information about a specific resource

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
resourceIdYesAzure Resource ID

Implementation Reference

  • Registration of the 'get-resource-details' tool in the listTools response, including name, description, and input schema.
      name: "get-resource-details",
      description: "Get detailed information about a specific resource",
      inputSchema: {
        type: "object",
        properties: {
          resourceId: {
            type: "string",
            description: "Azure Resource ID",
          },
        },
        required: ["resourceId"],
      },
    },
  • Main handler function for 'get-resource-details' tool. Validates input, handles caching, and delegates to AzureOperations.getResource for the actual retrieval.
    private async handleGetResourceDetails(args: any) {
      const { resourceId } = z
        .object({
          resourceId: z.string().min(1, "Resource ID cannot be empty"),
        })
        .parse(args);
    
      if (!this.context.resourceClient) {
        throw new AzureMCPError("Client not initialized", "NO_CLIENT");
      }
    
      try {
        // The resource ID format is: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{provider}/{resourceType}/{resourceName}
        const parts = resourceId.split("/");
        if (parts.length < 8) {
          throw new AzureResourceError("Invalid resource ID format");
        }
    
        const cacheKey = `resource-${resourceId}`;
        const resource = await this.getCachedResource(
          cacheKey,
          async () => {
            // Use azureOperations to get the resource
            return await this.azureOperations.getResource(resourceId);
          },
          60000
        ); // Cache for 1 minute
    
        return {
          id: resource.id,
          name: resource.name,
          type: resource.type,
          location: resource.location,
          tags: resource.tags || {},
          properties: resource.properties || {},
        };
      } catch (error) {
        this.logWithContext("error", `Error getting resource details: ${error}`, {
          error,
        });
        throw new AzureResourceError(`Failed to get resource details: ${error}`);
      }
    }
  • Helper method in AzureOperations class that executes the Azure SDK call to get resource details by resource ID.
    async getResource(resourceId: string) {
      if (!this.context.resourceClient) {
        throw new AzureMCPError("Client not initialized", "NO_CLIENT");
      }
    
      return await this.context.resourceClient.resources.getById(
        resourceId,
        "latest"
      );
    }

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/kalivaraprasad-gonapa/azure-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server