Skip to main content
Glama
cloudbring

New Relic MCP Server

by cloudbring

get_entity_details

Fetch complete details for a New Relic entity using its GUID to analyze its configuration and metrics.

Instructions

Get detailed information about a specific entity

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
entity_guidYesThe GUID of the entity

Implementation Reference

  • The getEntityDetails method on EntityTool class that executes the tool logic. It sends a NerdGraph GraphQL query to fetch detailed entity info by GUID, including fields like guid, name, type, domain, entityType, reporting, tags, alert violations (for AlertableEntity), APM settings (for ApmApplicationEntity), relationships, and golden metrics. Returns the entity data or throws if not found.
    async getEntityDetails(input: { entity_guid: string }): Promise<Record<string, unknown>> {
      const graphqlQuery = `{
        actor {
          entity(guid: "${input.entity_guid}") {
            guid
            name
            type
            domain
            entityType
            reporting
            tags {
              key
              values
            }
            ... on AlertableEntity {
              alertSeverity
              recentAlertViolations {
                alertSeverity
                violationId
                openedAt
                closedAt
                violationUrl
              }
            }
            ... on ApmApplicationEntity {
              language
              settings {
                apdexTarget
              }
            }
            relationships {
              type
              target {
                entities {
                  guid
                  name
                }
              }
            }
            goldenMetrics {
              metrics {
                name
                value
                unit
              }
            }
          }
        }
      }`;
    
      const response = (await this.client.executeNerdGraphQuery(graphqlQuery)) as {
        data?: { actor?: { entity?: Record<string, unknown> } };
      };
      const entity = response.data?.actor?.entity;
    
      if (!entity) {
        throw new Error('Entity not found');
      }
    
      return entity;
    }
  • The getDetailsTool() method defines the tool's name ('get_entity_details'), description, and inputSchema — requiring a single string parameter 'entity_guid'.
    getDetailsTool(): Tool {
      return {
        name: 'get_entity_details',
        description: 'Get detailed information about a specific entity',
        inputSchema: {
          type: 'object',
          properties: {
            entity_guid: {
              type: 'string',
              description: 'The GUID of the entity',
            },
          },
          required: ['entity_guid'],
        },
      };
    }
  • src/server.ts:72-74 (registration)
    Tool registration in server.ts: entityTool.getDetailsTool() is called and the returned Tool object is added to the tools map in the registerTools() method.
    entityTool.getSearchTool(),
    entityTool.getDetailsTool(),
    alertTool.getPoliciesTool(),
  • The switch-case handler in executeTool() method of NewRelicMCPServer. It extracts entity_guid from args, validates it's a non-empty string, and delegates to new EntityTool(this.client).getEntityDetails({ entity_guid }).
    case 'get_entity_details': {
      const { entity_guid } = args as Record<string, unknown>;
      if (typeof entity_guid !== 'string' || entity_guid.trim() === '') {
        throw new Error('get_entity_details: "entity_guid" (non-empty string) is required');
      }
      return await new EntityTool(this.client).getEntityDetails({ entity_guid });
    }
  • The executeNerdGraphQuery method used by getEntityDetails to make the actual GraphQL API call to New Relic's NerdGraph endpoint. Handles auth, POST request, and JSON response parsing.
    async executeNerdGraphQuery<T = unknown>(
      query: string,
      variables?: Record<string, unknown>
    ): Promise<GraphQLResponse<T>> {
      // Check if API key is missing or empty
      if (!this.apiKey || this.apiKey === '' || this.apiKey.length === 0) {
        throw new Error('NEW_RELIC_API_KEY environment variable is not set');
      }
    
      const response = await fetch(NERDGRAPH_URL, {
        method: 'POST',
        headers: {
          'Content-Type': 'application/json',
          'API-Key': this.apiKey,
        },
        body: JSON.stringify({ query, variables }),
      });
    
      if (!response.ok) {
        if (response.status === 401) {
          throw new Error('Unauthorized: Invalid API key');
        }
        throw new Error(`NerdGraph API error: ${response.status} ${response.statusText}`);
      }
    
      return (await response.json()) as GraphQLResponse<T>;
    }
Behavior2/5

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

No annotations exist, so the description must disclose behavior. It only says 'detailed information' without specifying what that includes, or any traits like read-only, idempotency, or performance. For a simple get operation, more detail would help.

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 elegantly short—one sentence of six words. Every word contributes meaning with no redundancy.

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 simplicity of the tool (one required parameter, no output schema, no annotations), the description is minimally adequate. It lacks details about return values or error conditions, but for a basic read operation, it may suffice.

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 input schema has 100% coverage for the single parameter (entity_guid). The description adds 'detailed information' but not much beyond the schema's own description. Baseline 3 applies since schema covers the parameter.

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 'Get detailed information about a specific entity' clearly states the verb (Get) and resource (entity details). It distinguishes from sibling tools like list_open_incidents or search_entities by implying retrieval of a single entity's full detail. However, 'entity' is broad and could be more specific.

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?

No guidance is provided on when to use this tool versus alternatives like get_account_details or search_entities. The description lacks context for choosing among 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/cloudbring/newrelic-mcp'

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