@juspay/neurolink
Version:
The pipe layer of an AI nervous system: one interface connecting provider neurons to your application, across three inference types — generate, stream and decide. `decide` returns typed, calibrated judgements from a non-generative model (~400ms, ~$0.00002
33 lines (32 loc) • 1.54 kB
TypeScript
/**
* MCP tools → realtime function tools bridge (realtime mode).
*
* In speech-to-speech mode the realtime model (Gemini Live, or xAI Grok Voice)
* owns the tool loop, so an external MCP server's tools are registered as
* LiveKit function tools rather than NeuroLink tools. This connects to the MCP
* server as the calling user (`x-auth-token` + base64 `x-context`), sanitizes
* each tool's schema into the Gemini-safe subset (kept for both backends), wires
* WRITE-labeled (destructive) tools through a HITL confirmation, and forwards
* tool start/result events to the browser bridge.
*
* `@livekit/agents` and `@modelcontextprotocol/sdk` are imported dynamically so
* the core package does not require them unless the realtime agent is used.
*
* See docs/features/livekit-voice-agent.md.
*/
import type { llm as llmNs } from "@livekit/agents";
import type { BuildRealtimeMcpToolsParams } from "../../types/index.js";
/** Flatten an MCP tool result's text content into a single string for the model. */
export declare function mcpResultToText(result: unknown): string;
/**
* Connect to the MCP server as the calling user and bridge every tool into a
* LiveKit `ToolContext`. Returns that context + the client (close on shutdown).
* The server already scopes the tool list by `x-context`, so no client-side
* filtering is needed.
*/
export declare function buildRealtimeMcpTools(params: BuildRealtimeMcpToolsParams): Promise<{
tools: llmNs.ToolContext;
client: {
close: () => Promise<void>;
};
}>;