kiro_chat
Send chat messages to Kiro CLI for AI responses with session management, process pooling, and multi-project workflow support.
Instructions
Send a chat message to kiro-cli and get AI response
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| message | Yes | The message to send to kiro-cli | |
| session_id | No | Optional session ID. Uses active session if not provided | |
| stream | No | Whether to stream the response |
Implementation Reference
- src/kiro_cli_mcp/server.py:196-215 (handler)Primary handler function _handle_chat that executes the core logic: extracts arguments, gets/creates session, executes chat via command_executor, handles streaming flag (fallback), returns response as dict.async def _handle_chat( session_manager: SessionManager, command_executor: CommandExecutor, arguments: dict[str, Any] ) -> dict[str, Any]: """Handle kiro_chat tool call.""" message = arguments.get("message", "") session_id = arguments.get("session_id") stream = arguments.get("stream", False) session = await session_manager.get_or_create_session(session_id) if stream: # Note: Streaming not fully supported in current MCP SDK # Fall back to non-streaming logger.warning("Streaming requested but not fully supported, using non-streaming") response = await command_executor.execute_chat(session, message) return response.to_dict()
- src/kiro_cli_mcp/tools.py:7-29 (schema)Input schema definition for the kiro_chat tool, specifying parameters: message (required), session_id (optional), stream (boolean, default False).{ "name": "kiro_chat", "description": "Send a chat message to kiro-cli and get AI response", "inputSchema": { "type": "object", "properties": { "message": { "type": "string", "description": "The message to send to kiro-cli" }, "session_id": { "type": "string", "description": "Optional session ID. Uses active session if not provided" }, "stream": { "type": "boolean", "description": "Whether to stream the response", "default": False } }, "required": ["message"] } },
- src/kiro_cli_mcp/server.py:67-78 (registration)Registration via handle_list_tools decorator (@server.list_tools()), which constructs and returns Tool objects from tools.py definitions, including kiro_chat.@server.list_tools() async def handle_list_tools() -> list[Tool]: """List available tools.""" tools_data = get_all_tools() return [ Tool( name=tool["name"], description=tool["description"], inputSchema=tool["inputSchema"] ) for tool in tools_data ]
- src/kiro_cli_mcp/server.py:96-97 (handler)Dispatch logic in main @server.call_tool() handler that routes 'kiro_chat' calls to the _handle_chat function.if name == "kiro_chat": result = await _handle_chat(session_manager, command_executor, arguments)