@n8n/n8n-nodes-langchain
Version:

60 lines (59 loc) • 2.71 kB
TypeScript
import type { Authorization, DefaultConversationState, DefaultUserState, TurnContext, TurnState } from '@microsoft/agents-hosting';
import { AgentApplication } from '@microsoft/agents-hosting';
import { type IDataObject, type IWebhookFunctions, type INodePropertyOptions } from 'n8n-workflow';
import { InvokeAgentScope } from '@microsoft/agents-a365-observability';
import { type Activity } from '@microsoft/agents-activity';
import { StructuredToolkit } from 'n8n-core';
import { buildMcpToolName } from '../../mcp/McpClientTool/utils';
export { buildMcpToolName };
export type MicrosoftAgent365Credentials = {
clientId: string;
tenantId: string;
clientSecret: string;
};
export type ActivityInfo = {
id?: string;
type?: string;
channelId?: string;
conversationId?: string;
from?: {
id?: string;
name?: string;
};
recipient?: {
id?: string;
name?: string;
};
timestamp?: string;
locale?: string;
};
export type McpToolCallLog = {
serverName: string;
toolName: string;
input: IDataObject;
output: unknown;
isError: boolean;
durationMs: number;
timestamp: string;
};
export type ActivityCapture = {
input: string;
output: string[];
activity: ActivityInfo;
mcpToolLogs?: McpToolCallLog[];
};
export declare function extractActivityInfo(activity: Activity): ActivityInfo;
export declare const microsoftMcpServers: INodePropertyOptions[];
export declare function createMicrosoftAgentApplication(credentials: MicrosoftAgent365Credentials): AgentApplication<TurnState<DefaultConversationState, DefaultUserState>>;
export declare function getMicrosoftMcpTools(turnContext: TurnContext, authorization: Authorization, mcpAuthToken: string, selectedTools: string[] | undefined): Promise<{
toolkits: StructuredToolkit[];
logs: McpToolCallLog[];
client: {
close(): Promise<void>;
};
} | undefined>;
export declare const configureActivityCallback: (nodeContext: IWebhookFunctions, credentials: MicrosoftAgent365Credentials, mcpTokenRef: {
token: string | undefined;
}, authorization: Authorization, activityCapture: ActivityCapture) => (turnContext: TurnContext) => Promise<void>;
export declare function disposeActivityResources(invokeAgentScope: InvokeAgentScope, mcpClient: NonNullable<Awaited<ReturnType<typeof getMicrosoftMcpTools>>>['client'] | undefined): Promise<void>;
export declare function configureAdapterProcessCallback(nodeContext: IWebhookFunctions, agent: AgentApplication<TurnState<DefaultConversationState, DefaultUserState>>, credentials: MicrosoftAgent365Credentials, activityCapture: ActivityCapture): (turnContext: TurnContext) => Promise<void>;