Skip to main content
Glama

get-resource-details

Retrieve comprehensive details for a specific Azure resource by providing its Resource ID, enabling efficient resource management and insights through the Azure MCP Server.

Instructions

Get detailed information about a specific resource

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
resourceIdYesAzure Resource ID

Implementation Reference

  • Main handler method for the 'get-resource-details' tool. Performs input validation, caching, error handling, delegates to AzureOperations.getResource, and returns formatted resource details.
    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 performs the actual Azure SDK call to retrieve resource details by ID using ResourceManagementClient.resources.getById.
    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" ); }
  • Tool registration in the handleListTools method, defining the tool name, description, and input schema for 'get-resource-details'.
    { 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"], }, },
  • Zod schema validation for input arguments within the handler function.
    const { resourceId } = z .object({ resourceId: z.string().min(1, "Resource ID cannot be empty"), }) .parse(args);

Other Tools

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

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