get_user
Retrieve specific user details from New Relic monitoring data by providing a user ID for access control and management purposes.
Instructions
Get details for a specific user
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| user_id | Yes |
Implementation Reference
- newrelic_mcp/server.py:632-642 (handler)The main MCP tool handler for the 'get_user' tool. It checks if the client is initialized, calls the client's get_user method with the provided user_id, and returns the result as formatted JSON or an error message.@mcp.tool() async def get_user(user_id: str) -> str: """Get details for a specific user""" if not client: return json.dumps({"error": "New Relic client not initialized"}) try: result = await client.get_user(user_id) return json.dumps(result, indent=2) except Exception as e: return json.dumps({"error": str(e)}, indent=2)
- newrelic_mcp/server.py:131-134 (helper)Helper method in NewRelicClient class that performs the actual HTTP GET request to the New Relic API endpoint for retrieving specific user details.async def get_user(self, user_id: str) -> Dict[str, Any]: """Get details for a specific user""" url = f"{self.base_url}/users/{user_id}.json" return await self._make_request("GET", url)
- newrelic_mcp/server.py:632-632 (registration)The @mcp.tool() decorator registers the get_user function as an MCP tool with the name 'get_user'.@mcp.tool()