list_sessions
Retrieve completed and active behavioral sessions from the jikan MCP server. Filter by date range, activity type, and paginate results to manage meditation, focus, and exercise tracking.
Instructions
List completed and active sessions. Free (0 credits).
Args:
from_date: Start date filter in YYYY-MM-DD format (optional).
to_date: End date filter in YYYY-MM-DD format (optional).
activity_id: Filter by activity type ID (optional, 0 = no filter).
limit: Number of results to return (default 20, max 50).
offset: Pagination offset (default 0).Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| from_date | No | ||
| to_date | No | ||
| activity_id | No | ||
| limit | No | ||
| offset | No |
Implementation Reference
- server.py:82-108 (handler)The list_sessions tool implementation decorated with @mcp.tool(). This function lists completed and active sessions by making a GET request to /sessions endpoint with optional date, activity_id, limit, and offset parameters. Returns the API response as JSON.
@mcp.tool() def list_sessions( from_date: str = "", to_date: str = "", activity_id: int = 0, limit: int = 20, offset: int = 0, ) -> dict: """List completed and active sessions. Free (0 credits). Args: from_date: Start date filter in YYYY-MM-DD format (optional). to_date: End date filter in YYYY-MM-DD format (optional). activity_id: Filter by activity type ID (optional, 0 = no filter). limit: Number of results to return (default 20, max 50). offset: Pagination offset (default 0). """ params: dict = {"limit": limit, "offset": offset} if from_date: params["from"] = from_date if to_date: params["to"] = to_date if activity_id: params["activity_id"] = activity_id with _client() as client: response = client.get("/sessions", params=params) return response.json() - server.py:23-24 (helper)Helper function that creates and returns an httpx.Client configured with the base URL and API headers. Used by list_sessions to make HTTP requests.
def _client() -> httpx.Client: return httpx.Client(base_url=MG_BASE_URL, headers=HEADERS, timeout=30)