start_streaming_chat
Initiate a real-time chat session with an agent, enabling continuous message exchange. Specify the agent name and initial message to begin streaming interactions.
Instructions
Start a streaming chat session
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| agent_name | Yes | Name of the agent | |
| message | Yes | Initial message | |
| streaming | No | Enable streaming |
Implementation Reference
- src/index_fixed.ts:325-338 (schema)Defines the input schema and description for the 'start_streaming_chat' MCP tool.{ name: 'start_streaming_chat', description: 'Start a streaming chat session with real-time updates', inputSchema: { type: 'object', properties: { agent_name: { type: 'string', description: 'Name of the agent to chat with' }, message: { type: 'string', description: 'Initial message' }, streaming: { type: 'boolean', description: 'Enable real-time streaming' }, progress_token: { type: 'string', description: 'Token for progress notifications' }, }, required: ['agent_name', 'message'], }, },
- src/index_fixed.ts:308-367 (registration)Registers the 'start_streaming_chat' tool in the MCP server's ListToolsRequestSchema handler by including it in the static list of available tools.this.server.setRequestHandler(ListToolsRequestSchema, async () => ({ tools: [ { name: 'create_streaming_workflow', description: 'Create a workflow with real-time streaming and progress updates', inputSchema: { type: 'object', properties: { workflow_name: { type: 'string', description: 'Name for the workflow' }, workflow_type: { type: 'string', description: 'Type of workflow' }, agents: { type: 'array', description: 'List of agent configurations' }, streaming: { type: 'boolean', description: 'Enable streaming' }, progress_token: { type: 'string', description: 'Progress token' }, }, required: ['workflow_name', 'workflow_type', 'agents'], }, }, { name: 'start_streaming_chat', description: 'Start a streaming chat session with real-time updates', inputSchema: { type: 'object', properties: { agent_name: { type: 'string', description: 'Name of the agent to chat with' }, message: { type: 'string', description: 'Initial message' }, streaming: { type: 'boolean', description: 'Enable real-time streaming' }, progress_token: { type: 'string', description: 'Token for progress notifications' }, }, required: ['agent_name', 'message'], }, }, { name: 'create_agent', description: 'Create a new AutoGen agent with enhanced capabilities', inputSchema: { type: 'object', properties: { name: { type: 'string', description: 'Unique name for the agent' }, type: { type: 'string', description: 'Agent type' }, system_message: { type: 'string', description: 'System message' }, llm_config: { type: 'object', description: 'LLM configuration' }, }, required: ['name', 'type'], }, }, { name: 'execute_workflow', description: 'Execute a workflow with streaming support', inputSchema: { type: 'object', properties: { workflow_name: { type: 'string', description: 'Workflow name' }, input_data: { type: 'object', description: 'Input data' }, streaming: { type: 'boolean', description: 'Enable streaming' }, }, required: ['workflow_name', 'input_data'], }, }, ], }));
- src/index_fixed.ts:380-382 (handler)Dispatch logic in CallToolRequestSchema handler that identifies 'start_streaming_chat' as a streaming tool and routes it to handleStreamingTool.if (toolName === 'create_streaming_workflow' || toolName === 'start_streaming_chat') { return await this.handleStreamingTool(toolName, args, progressToken); }
- src/index_fixed.ts:407-437 (handler)Executes the 'start_streaming_chat' tool logic: initializes streaming progress notifications, calls the Python backend handler, sends SSE updates if streaming enabled, and completes with final notification.private async handleStreamingTool(toolName: string, args: any, progressToken?: string): Promise<any> { if (progressToken) { await this.sendProgressNotification(progressToken, 25, 'Initializing streaming...'); } const result = await this.callPythonHandler(toolName, args); if (args.streaming && this.sseTransports.size > 0) { for (const transport of this.sseTransports.values()) { try { await transport.send({ jsonrpc: '2.0', method: 'notifications/progress', params: { progressToken: progressToken || 'streaming', progress: 75, message: 'Streaming updates...', data: result, }, }); } catch (error) { console.error('Error sending streaming update:', error); } } } if (progressToken) { await this.sendProgressNotification(progressToken, 100, 'Streaming completed'); } return result;