search_entities
Find New Relic monitoring entities using search queries to identify applications, hosts, services, or other monitored components for observability analysis.
Instructions
Search for entities in New Relic
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| query | Yes | ||
| limit | No |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |
Implementation Reference
- newrelic_mcp/server.py:455-466 (handler)MCP tool handler function for 'search_entities'. Handles client initialization check, calls the underlying client method, and returns JSON-formatted results or errors.
@mcp.tool() async def search_entities(query: str, limit: int = 25) -> str: """Search for entities in New Relic""" if not client: return json.dumps({"error": "New Relic client not initialized"}) try: result = await client.search_entities(query, limit) return json.dumps(result, indent=2) except Exception as e: return json.dumps({"error": str(e)}, indent=2) - newrelic_mcp/server.py:247-273 (helper)NewRelicClient helper method that executes the GraphQL query for searching entities via NerdGraph API.
async def search_entities(self, query: str, limit: int = 25) -> Dict[str, Any]: """Search for entities in New Relic""" gql_query = """ query($query: String!, $limit: Int!) { actor { entitySearch(query: $query) { results(limit: $limit) { entities { guid name type entityType domain tags { key values } } } } } } """ variables = {"query": query, "limit": limit} return await self.nerdgraph_query(gql_query, variables)