Skip to main content
Glama

stop_session

Ends an active behavioral tracking session in the jikan MCP server. The tool automatically calculates session duration using stored timestamps, eliminating manual time tracking for activities like meditation, focus, or exercise.

Instructions

Stop an active session. Free (0 credits).

The server computes actual_sec automatically using the stored start time.
The agent does not need to track elapsed time.

Args:
    ak_id: The session ID returned by start_session.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
ak_idYes

Implementation Reference

  • server.py:55-67 (handler)
    The stop_session tool handler - decorated with @mcp.tool() for registration. Takes an ak_id parameter and makes a PATCH request to /sessions/{ak_id}/stop to stop an active session. Returns the server response as a dict.
    @mcp.tool()
    def stop_session(ak_id: int) -> dict:
        """Stop an active session. Free (0 credits).
    
        The server computes actual_sec automatically using the stored start time.
        The agent does not need to track elapsed time.
    
        Args:
            ak_id: The session ID returned by start_session.
        """
        with _client() as client:
            response = client.patch(f"/sessions/{ak_id}/stop")
        return response.json()
  • The _client() helper function that creates and returns an httpx.Client instance configured with the base URL, API key headers, and 30-second timeout. Used by stop_session to make HTTP requests.
    def _client() -> httpx.Client:
        return httpx.Client(base_url=MG_BASE_URL, headers=HEADERS, timeout=30)

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/thunderrabbit/jikan'

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