Skip to main content
Glama

kiro_session_clear

Clear Kiro CLI session history by deleting the session.json file to manage workspace data and maintain isolated project contexts.

Instructions

Clear kiro-cli session history in working directory (deletes .kiro/session.json)

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
session_idNoOptional MCP session ID

Implementation Reference

  • The handler function that implements the kiro_session_clear tool by deleting the .kiro/session.json file in the session's working directory.
    async def _handle_session_clear(
        session_manager: SessionManager,
        arguments: dict[str, Any]
    ) -> dict[str, Any]:
        """Handle kiro_session_clear tool call - clear kiro-cli session file."""
        session_id = arguments.get("session_id")
        session = await session_manager.get_or_create_session(session_id)
        
        # Delete .kiro/session.json in working directory
        working_dir = session.working_directory or "."
        session_file = Path(working_dir) / ".kiro" / "session.json"
        
        if session_file.exists():
            session_file.unlink()
            logger.info(f"Cleared kiro-cli session file: {session_file}")
            return {
                "success": True,
                "message": f"Cleared kiro-cli session in {working_dir}",
                "path": str(session_file),
            }
        else:
            return {
                "success": False,
                "message": "No kiro-cli session file found",
                "path": str(session_file),
            }
  • The input schema definition for the kiro_session_clear tool, specifying an optional session_id parameter.
    {
        "name": "kiro_session_clear",
        "description": "Clear kiro-cli session history in working directory (deletes .kiro/session.json)",
        "inputSchema": {
            "type": "object",
            "properties": {
                "session_id": {
                    "type": "string",
                    "description": "Optional MCP session ID"
                }
            }
        }
    },
  • The dispatch registration in the main handle_call_tool function that routes calls to the kiro_session_clear handler.
    elif name == "kiro_session_clear":
        result = await _handle_session_clear(session_manager, arguments)

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/vanphappi/kiro-cli-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server