import type { FetchFn, McpToolCallSettledEvent } from '@n8n/agents'; import type { AgentJsonConfig } from '@n8n/api-types'; import type { IWorkflowExecuteAdditionalData } from 'n8n-workflow'; export interface AgentToolInstrumentationContext { toolName: string; toolKind: 'node' | 'workflow'; } export interface AgentMcpToolCallSettledContext extends McpToolCallSettledEvent { serverName: string; } export interface AgentRuntimeInstrumentation { modelFetch?: FetchFn; mcpFetch?: FetchFn; onMcpToolCallSettled?: (event: AgentMcpToolCallSettledContext) => void | Promise; webSearch?: (args: { query: string; maxResults?: number; includeDomains?: string[]; excludeDomains?: string[]; }) => Promise; configureToolAdditionalData?: (additionalData: IWorkflowExecuteAdditionalData, context: AgentToolInstrumentationContext) => void; transformDelegatedAgentConfig?: (config: AgentJsonConfig, context: { subAgentId: string; }) => AgentJsonConfig; } export type InstrumentToolAdditionalData = NonNullable;