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
| Name | Required | Description | Default |
|---|---|---|---|
| resourceId | Yes | Azure Resource ID |
Implementation Reference
- src/AzureServer.ts:363-375 (registration)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"], }, },
- src/AzureServer.ts:603-645 (handler)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}`); } }
- src/AzureServer.ts:981-990 (helper)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" ); }