Member Junction
    Preparing search index...

    Manages a client session connected to an MJ agent.

    Handles bidirectional communication via GraphQL:

    • Subscribes to ClientToolRequest notifications for tool invocation
    • Sends tool responses via RespondToClientToolRequest mutation
    • Sends enriched tool definitions via UpdateClientToolDefinitions mutation
    • Wraps GraphQLAIClient for agent execution (RunAgent, RunAgentFromConversationDetail)

    All events are exposed as RxJS observables for framework-agnostic reactive consumption.

    const session = new AgentClientSession();
    session.RegisterTool({
    Name: 'NavigateToRecord',
    Description: 'Open an entity record',
    ParameterSchema: { type: 'object', properties: { EntityName: { type: 'string' } } },
    Handler: async (params) => ({ Success: true, Data: 'navigated' })
    });
    session.StartSession('session-123');
    session.ToolRequested$.subscribe(event => console.log('Tool invoked:', event));
    Index

    Constructors

    Properties

    AgentProgress$: Subject<AgentProgress> = ...

    Emitted on agent progress updates during RunAgent / RunAgentFromConversationDetail

    Error$: Subject<SessionError> = ...

    Emitted when an error occurs during tool execution or communication

    SessionActive$: Subject<boolean> = ...

    Emitted when session state changes (true = active, false = stopped)

    ToolExecuted$: Subject<ClientToolResultEvent> = ...

    Emitted after a tool has been executed (with result)

    ToolRequested$: Subject<ClientToolRequestEvent> = ...

    Emitted when a tool request is received from the server (before execution)

    Accessors

    • get IsActive(): boolean

      Whether a session is currently active and listening for tool requests

      Returns boolean

    • get SessionId(): string

      The current session ID, or null if no session is active

      Returns string

    Methods

    • Dispose the session: stop listening, complete all observables, and clear state. Call this when the session is no longer needed to prevent memory leaks.

      Returns void

    • Register a client-side tool. The consuming application calls this to make tools available for server-side agents to invoke. Re-registration is allowed (existing tool is replaced).

      Parameters

      • tool: {
            Description: string;
            Handler: ClientToolHandler;
            Name: string;
            ParameterSchema: Record<string, unknown>;
        }

      Returns void

    • Remove a client tool at runtime.

      Parameters

      • toolName: string

      Returns Promise<void>

    • Start listening for client tool requests for a specific session. Subscribes to the GraphQL ClientToolRequest subscription via the data provider.

      Parameters

      • sessionId: string

        The agent session ID to listen for

      Returns void

    • Stop listening for client tool requests and clean up the session.

      Returns void

    • Unregister a client-side tool.

      Parameters

      • toolName: string

      Returns void