get_account_details
Retrieve details for your New Relic account, optionally specifying a target account ID.
Instructions
Get New Relic account details
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| target_account_id | No | Optional account ID to get details for |
Implementation Reference
- src/client/newrelic-client.ts:84-112 (handler)The core handler function that executes the get_account_details tool logic. It uses the NerdGraph API to query account details (id, name) for a given 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/client/newrelic-client.ts:39-43 (schema)The AccountDetails interface defines the return type of getAccountDetails: accountId (string), name (string), and optional region (string).
export interface AccountDetails { accountId: string; name: string; region?: string; } - src/server.ts:88-100 (registration)Registration of the get_account_details tool with its name, description, and inputSchema (expects optional target_account_id).
{ 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', }, }, }, }, - src/server.ts:203-204 (handler)The dispatch case in executeTool that calls this.client.getAccountDetails(accountId) when the tool name is 'get_account_details'.
case 'get_account_details': return await this.client.getAccountDetails(accountId); - src/server.ts:300-300 (registration)get_account_details is listed as requiring an account ID in the requiresAccountId method.
'get_account_details',