Skip to main content
Glama
piekstra

New Relic MCP Server

by piekstra

list_log_parsing_rules

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

Instructions

List all log parsing rules for an account

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
account_idNo

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Implementation Reference

  • MCP tool registration and handler function for 'list_log_parsing_rules'. This is the entry point decorated with @mcp.tool() that handles input validation, client checks, and delegates to the log_parsing module.
    @mcp.tool()
    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)
  • Core helper function that executes the NerdGraph GraphQL query to fetch and filter log parsing rules for the given account.
    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 []
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries the full burden of behavioral disclosure. It states 'List all' but doesn't describe return format, pagination, permissions required, rate limits, or error conditions. For a read operation with zero annotation coverage, this is a significant gap in behavioral context.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, efficient sentence with zero waste. It's appropriately sized and front-loaded, directly stating the tool's purpose without unnecessary elaboration.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool's low complexity (1 parameter, read operation) and the presence of an output schema (which handles return values), the description is minimally adequate. However, with no annotations and incomplete parameter guidance, it leaves gaps in usage context and behavioral transparency.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The description mentions 'for an account' which loosely relates to the 'account_id' parameter, but with 0% schema description coverage and only 1 parameter, it adds minimal meaning beyond what the schema title ('Account Id') provides. The baseline is 3 since schema coverage is low but the description partially compensates.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the action ('List all') and resource ('log parsing rules for an account'), providing a specific verb+resource combination. However, it doesn't differentiate from sibling tools like 'list_alert_policies' or 'list_applications' beyond the resource type, missing explicit sibling distinction.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives. It doesn't mention prerequisites, context for usage, or exclusions, leaving the agent to infer usage from the tool name alone among many list-type siblings.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

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