Mcp Web Transport
Interfaces
Interfaces
ChatMessage
Properties:
| Property | Type | Required | Description |
|---|---|---|---|
role | "user" | "assistant" | "system" | Yes | |
content | string | Yes | |
toolCalls | { toolName: string; arguments: any; result?: any; }[] | undefined | No |
StreamCallbacks
Properties:
| Property | Type | Required | Description |
|---|---|---|---|
onText | (text: string) => void | Yes | |
onToolCall | (toolName: string, args: any) => void | Yes | |
onToolResult | (toolName: string, result: any) => void | Yes | |
onError | (error: string) => void | Yes |
ProviderConfig
Properties:
| Property | Type | Required | Description |
|---|---|---|---|
provider | "anthropic" | "openai" | "xai" | Yes | |
model | string | Yes | |
apiKey | string | Yes | |
baseUrl | string | undefined | No | |
temperature | number | undefined | No | |
maxTokens | number | undefined | No |
MCPInvokeParams
Properties:
| Property | Type | Required | Description |
|---|---|---|---|
toolName | string | Yes | |
arguments | Record<string, any> | Yes | |
userId | string | Yes | |
agentId | string | Yes | |
conversationId | string | Yes | |
provider | ProviderConfig | Yes | |
onChunk | ((chunk: StreamChunk) => void) | undefined | No |
TokenUsage
Properties:
| Property | Type | Required | Description |
|---|---|---|---|
promptTokens | number | Yes | |
completionTokens | number | Yes | |
totalTokens | number | Yes |
MCPResult
Properties:
| Property | Type | Required | Description |
|---|---|---|---|
success | boolean | Yes | |
content | string | undefined | No | |
toolCalls | { toolName: string; arguments: Record<string, any>; result?: any; }[] | undefined | No | |
error | string | undefined | No | |
usage | TokenUsage | undefined | No | |
latencyMs | number | Yes |