Skip to main content
Glama

kiro_session_end

Terminate an active Kiro CLI session to free resources and manage workflows by specifying the session ID.

Instructions

End a kiro-cli session

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
session_idYesThe session ID to end

Implementation Reference

  • Main handler function for kiro_session_end tool that extracts the session_id from arguments and delegates to SessionManager.end_session(session_id)
    async def _handle_session_end(
        session_manager: SessionManager,
        arguments: dict[str, Any]
    ) -> dict[str, Any]:
        """Handle kiro_session_end tool call."""
        session_id = arguments.get("session_id", "")
        await session_manager.end_session(session_id)
        return {
            "success": True,
            "session_id": session_id,
        }
  • Input schema definition for the kiro_session_end tool, specifying required session_id parameter
    {
        "name": "kiro_session_end",
        "description": "End a kiro-cli session",
        "inputSchema": {
            "type": "object",
            "properties": {
                "session_id": {
                    "type": "string",
                    "description": "The session ID to end"
                }
            },
            "required": ["session_id"]
        }
    },
  • Registration/dispatch of kiro_session_end tool call within the main handle_call_tool function
    elif name == "kiro_session_end":
        result = await _handle_session_end(session_manager, arguments)
  • SessionManager.end_session method implementing the core logic to terminate the kiro-cli process and remove the session
    async def end_session(self, session_id: str) -> bool:
        """End and cleanup a session.
        
        Args:
            session_id: The session ID to end
            
        Returns:
            True if session was ended
            
        Raises:
            SessionError: If session not found
        """
        async with self._lock:
            session = self.sessions.get(session_id)
            if session is None:
                raise SessionError(
                    code=ErrorCode.SESSION_NOT_FOUND,
                    details={"session_id": session_id},
                )
            
            # Terminate process if running
            if session.process is not None:
                try:
                    session.process.terminate()
                    await asyncio.wait_for(
                        session.process.wait(),
                        timeout=5.0,
                    )
                except asyncio.TimeoutError:
                    session.process.kill()
                except Exception:
                    pass
            
            # Remove from sessions
            del self.sessions[session_id]
            
            # Update active session if needed
            if self.active_session_id == session_id:
                if self.sessions:
                    self.active_session_id = next(iter(self.sessions.keys()))
                else:
                    self.active_session_id = None
            
            return True
Behavior2/5

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

With no annotations provided, the description carries the full burden of behavioral disclosure. It states the action ('End') but doesn't explain what 'ending' entails—whether it terminates processes, frees resources, or has irreversible effects. This lack of detail makes it difficult for an agent to assess the tool's impact.

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, direct sentence with no wasted words, making it easy to parse and understand immediately. It is appropriately sized for a simple tool with one parameter.

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

Completeness2/5

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

Given the lack of annotations and output schema, the description is incomplete. It doesn't explain the outcome of ending a session (e.g., whether it returns confirmation, frees resources, or affects other tools), leaving gaps in understanding the tool's full behavior and implications.

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

Parameters3/5

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

The input schema has 100% description coverage, with the single parameter 'session_id' clearly documented. The description adds no additional parameter semantics beyond what the schema provides, so it meets the baseline for adequate but not exceptional coverage.

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

Purpose4/5

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

The description clearly states the action ('End') and the resource ('a kiro-cli session'), making the purpose immediately understandable. However, it doesn't differentiate this tool from its sibling 'kiro_session_clear', which might have overlapping functionality, preventing a perfect score.

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_session_clear' or 'kiro_session_switch', nor does it mention prerequisites such as needing an active session. This leaves the agent with insufficient context for optimal tool selection.

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