Skip to main content
Glama
piekstra

New Relic MCP Server

by piekstra

list_log_parsing_rules

Retrieve all log parsing rules configured for a New Relic account to manage log data processing and analysis.

Instructions

List all log parsing rules for an account

Input Schema

NameRequiredDescriptionDefault
account_idNo

Input Schema (JSON Schema)

{ "properties": { "account_id": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "title": "Account Id" } }, "type": "object" }

Implementation Reference

  • Core implementation of list_log_parsing_rules: executes NerdGraph query to fetch and filter log parsing rules
    async def list_log_parsing_rules(client, account_id: str) -> List[Dict[str, Any]]: """List all log parsing rules for an account""" query = """ query($accountId: Int!) { actor { account(id: $accountId) { logConfigurations { parsingRules { accountId deleted description enabled grok id lucene nrql updatedAt createdBy { email name } } } } } } """ variables = {"accountId": int(account_id)} result = await client.nerdgraph_query(query, variables) if result and "data" in result: account_data = result["data"].get("actor", {}).get("account", {}) if account_data and "logConfigurations" in account_data: rules = account_data["logConfigurations"].get("parsingRules", []) return [r for r in rules if r and not r.get("deleted", False)] return []
  • MCP tool handler: registers the tool and wraps the core implementation with error handling and JSON serialization
    async def list_log_parsing_rules(account_id: Optional[str] = None) -> str: """List all log parsing rules for an account""" if not client: return json.dumps({"error": "New Relic client not initialized"}) # Use provided account_id or fall back to client's account_id acct_id = account_id or client.account_id if not acct_id: return json.dumps({"error": "Account ID required but not provided"}) try: result = await log_parsing.list_log_parsing_rules(client, acct_id) return json.dumps(result, indent=2) except Exception as e: return json.dumps({"error": str(e)}, indent=2)
  • Registration of the list_log_parsing_rules tool via FastMCP decorator
    async def list_log_parsing_rules(account_id: Optional[str] = None) -> str:

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/piekstra/newrelic-mcp-server'

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