search_entities
Find and identify New Relic monitoring entities using search queries to locate applications, hosts, services, and infrastructure components within your observability environment.
Instructions
Search for entities in New Relic
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| query | Yes | ||
| limit | No |
Input Schema (JSON Schema)
{
"properties": {
"limit": {
"default": 25,
"title": "Limit",
"type": "integer"
},
"query": {
"title": "Query",
"type": "string"
}
},
"required": [
"query"
],
"type": "object"
}
Implementation Reference
- newrelic_mcp/server.py:455-466 (handler)MCP tool handler that executes the search_entities tool by calling the NewRelicClient method and formatting the JSON response.@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)Helper method in NewRelicClient class that performs the actual GraphQL query to search for entities in New Relic.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)