Skip to main content
Glama
cloudbring

New Relic MCP Server

by cloudbring

get_account_details

Retrieve New Relic account information to view configuration, settings, and metadata for monitoring and management purposes.

Instructions

Get New Relic account details

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
target_account_idNoOptional account ID to get details for

Implementation Reference

  • The core handler function in NewRelicClient that executes a NerdGraph GraphQL query to fetch and return account details (ID and name) for the specified account ID.
    async getAccountDetails(accountId?: string): Promise<AccountDetails> {
      const id = accountId || this.defaultAccountId;
      if (!id) {
        throw new Error('Account ID must be provided');
      }
    
      type AccountResponse = { actor?: { account?: { id: string; name: string } } };
      const query = `{
        actor {
          account(id: ${id}) {
            id
            name
          }
        }
      }`;
    
      const response = (await this.executeNerdGraphQuery<AccountResponse>(
        query
      )) as GraphQLResponse<AccountResponse>;
    
      if (!response.data?.actor?.account) {
        throw new Error(`Account ${id} not found`);
      }
    
      return {
        accountId: response.data.actor.account.id,
        name: response.data.actor.account.name,
      };
    }
  • src/server.ts:89-100 (registration)
    Tool registration definition including name, description, and input schema. Added to the tools array and registered via this.tools.set().
      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',
          },
        },
      },
    },
  • Input schema definition for the tool, specifying optional target_account_id parameter.
    inputSchema: {
      type: 'object' as const,
      properties: {
        target_account_id: {
          type: 'string' as const,
          description: 'Optional account ID to get details for',
        },
      },
    },
  • TypeScript interface defining the output structure of account details.
    export interface AccountDetails {
      accountId: string;
      name: string;
      region?: string;
    }
  • Server-side dispatch handler that routes the tool call to the NewRelicClient.getAccountDetails method.
    case 'get_account_details':
      return await this.client.getAccountDetails(accountId);

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