Skip to main content
Glama
cloudbring

New Relic MCP Server

by cloudbring

get_entity_details

Retrieve comprehensive monitoring data for a specific New Relic entity using its GUID to analyze performance and troubleshoot issues.

Instructions

Get detailed information about a specific entity

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
entity_guidYesThe GUID of the entity

Implementation Reference

  • Core handler function that executes a comprehensive NerdGraph GraphQL query to retrieve detailed entity information, including GUID, name, type, tags, alert violations, APM settings, relationships, and golden metrics.
    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;
    }
  • Defines the MCP Tool specification for 'get_entity_details', including name, description, and inputSchema requiring a non-empty 'entity_guid' string.
    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:57-106 (registration)
    Registers the get_entity_details tool (via entityTool.getDetailsTool()) along with other tools into the server's tools map, which is used for tool listing and discovery.
    private registerTools(): void {
      const nrqlTool = new NrqlTool(this.client);
      const apmTool = new ApmTool(this.client);
      const entityTool = new EntityTool(this.client);
      const alertTool = new AlertTool(this.client);
      const syntheticsTool = new SyntheticsTool(this.client);
      const nerdGraphTool = new NerdGraphTool(this.client);
      const restDeployments = new RestDeploymentsTool();
      const restApm = new RestApmTool();
      const restMetrics = new RestMetricsTool();
    
      // Register all tools
      const tools = [
        nrqlTool.getToolDefinition(),
        apmTool.getListApplicationsTool(),
        entityTool.getSearchTool(),
        entityTool.getDetailsTool(),
        alertTool.getPoliciesTool(),
        alertTool.getIncidentsTool(),
        alertTool.getAcknowledgeTool(),
        syntheticsTool.getListMonitorsTool(),
        syntheticsTool.getCreateMonitorTool(),
        nerdGraphTool.getQueryTool(),
        // REST v2 tools
        restDeployments.getCreateTool(),
        restDeployments.getListTool(),
        restDeployments.getDeleteTool(),
        restApm.getListApplicationsTool(),
        restMetrics.getListMetricNamesTool(),
        restMetrics.getMetricDataTool(),
        restMetrics.getListApplicationHostsTool(),
        {
          name: 'get_account_details',
          description: 'Get New Relic account details',
          inputSchema: {
            type: 'object' as const,
            properties: {
              target_account_id: {
                type: 'string' as const,
                description: 'Optional account ID to get details for',
              },
            },
          },
        },
      ];
    
      tools.forEach((tool) => {
        this.tools.set(tool.name, tool);
      });
    }
  • Server dispatch handler for the tool: validates the entity_guid input argument and delegates execution to EntityTool.getEntityDetails.
    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 });
    }

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