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)
Behavior3/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries the full burden. It discloses the destructive behavior ('deletes .kiro/session.json'), which is crucial, but lacks details on permissions needed, error handling, or what happens if the file doesn't exist. It's adequate but leaves gaps in behavioral context.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, efficient sentence that front-loads the core action and resource. Every word earns its place, with no redundant or vague phrasing, making it highly concise and well-structured.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool's complexity (destructive operation with no annotations and no output schema), the description is minimally complete. It covers the purpose and destructive nature but lacks details on outcomes, errors, or usage context, leaving room for improvement in guiding the agent.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, so the schema already documents the optional 'session_id' parameter. The description adds no parameter-specific information, but with only one optional parameter, the baseline is high. It implies the tool operates on the working directory, which provides some context beyond the schema.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the specific action ('Clear') and target resource ('kiro-cli session history in working directory'), with explicit mention of the file being deleted ('.kiro/session.json'). It distinguishes from sibling tools like 'kiro_history_clear' by focusing on session history rather than general history.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives like 'kiro_history_clear' or 'kiro_session_end', nor does it mention prerequisites or exclusions. It states what the tool does but not when it's appropriate.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

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