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
| Name | Required | Description | Default |
|---|---|---|---|
| ak_id | Yes |
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() - server.py:23-24 (helper)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)