diff --git a/apps/sim/blocks/blocks/new_relic.ts b/apps/sim/blocks/blocks/new_relic.ts index f8912cd08ca..92640b31aaa 100644 --- a/apps/sim/blocks/blocks/new_relic.ts +++ b/apps/sim/blocks/blocks/new_relic.ts @@ -345,9 +345,17 @@ Return ONLY the numeric timestamp - no explanations, no extra text.`, resultCount: { type: 'number', description: 'Number of NRQL result rows' }, count: { type: 'number', description: 'Number of matching entities' }, query: { type: 'string', description: 'Entity search query New Relic executed' }, - entities: { type: 'json', description: 'Matching New Relic entities (guid, name, entityType)' }, + entities: { + type: 'json', + description: + 'Matching New Relic entities (guid, name, entityType, domain, reporting, alertSeverity, tags)', + }, nextCursor: { type: 'string', description: 'Cursor for the next entity search page' }, - entity: { type: 'json', description: 'New Relic entity details (guid, name, entityType)' }, + entity: { + type: 'json', + description: + 'New Relic entity details (guid, name, entityType, domain, reporting, alertSeverity, tags)', + }, event: { type: 'json', description: 'Created change tracking event metadata' }, messages: { type: 'json', description: 'New Relic change tracking messages' }, }, diff --git a/apps/sim/tools/new_relic/get_entity.ts b/apps/sim/tools/new_relic/get_entity.ts index 4e839a04f3b..52f4ce4c5b9 100644 --- a/apps/sim/tools/new_relic/get_entity.ts +++ b/apps/sim/tools/new_relic/get_entity.ts @@ -2,17 +2,16 @@ import type { NewRelicGetEntityParams, NewRelicGetEntityResponse } from '@/tools import { getNerdGraphEndpoint, gqlString, + type NewRelicRawEntity, newRelicHeaders, + normalizeNewRelicEntity, parseNerdGraphResponse, } from '@/tools/new_relic/utils' import type { ToolConfig } from '@/tools/types' interface GetEntityData { actor?: { - entity?: { - name?: string | null - entityType?: string | null - } | null + entity?: NewRelicRawEntity | null } | null } @@ -54,6 +53,15 @@ export const newRelicGetEntityTool: ToolConfig { data?: TData errors?: GraphQLError[] @@ -40,3 +50,17 @@ export const cleanOptionalString = (value?: string): string | undefined => { const trimmed = value?.trim() return trimmed ? trimmed : undefined } + +export const normalizeNewRelicEntity = (entity: NewRelicRawEntity): NewRelicEntity => ({ + guid: entity.guid ?? null, + name: entity.name ?? null, + entityType: entity.entityType ?? null, + domain: entity.domain ?? null, + reporting: entity.reporting ?? null, + alertSeverity: entity.alertSeverity ?? null, + tags: + entity.tags?.map((tag) => ({ + key: tag?.key ?? null, + values: tag?.values ?? [], + })) ?? [], +})