Skip to main content
Glama

start_session

Initiate a new behavioral tracking session for meditation, focus, or exercise activities. Records timestamps automatically and returns a session ID for future management.

Instructions

Start a new behavioral session. Costs 1 credit.

The server records the current time automatically — the agent does not
need to track time. Returns the new session including its ak_id, which
you need to stop or check the session later.

Args:
    activity_id: Activity type ID (default 1 = Meditation).
                 Use list_activities to see all options.
    timezone: IANA timezone name, e.g. 'Asia/Tokyo' (default UTC).
    intended_sec: Planned duration in seconds (default 0 = open-ended).

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
activity_idNo
timezoneNoUTC
intended_secNo

Implementation Reference

  • server.py:27-52 (handler)
    The start_session tool handler function decorated with @mcp.tool(). This function starts a new behavioral session by making a POST request to the /sessions endpoint with activity_id, timezone, and intended_sec parameters. Returns the session data including ak_id.
    @mcp.tool()
    def start_session(
        activity_id: int = 1,
        timezone: str = "UTC",
        intended_sec: int = 0,
    ) -> dict:
        """Start a new behavioral session. Costs 1 credit.
    
        The server records the current time automatically — the agent does not
        need to track time. Returns the new session including its ak_id, which
        you need to stop or check the session later.
    
        Args:
            activity_id: Activity type ID (default 1 = Meditation).
                         Use list_activities to see all options.
            timezone: IANA timezone name, e.g. 'Asia/Tokyo' (default UTC).
            intended_sec: Planned duration in seconds (default 0 = open-ended).
        """
        payload = {
            "activity_id": activity_id,
            "timezone": timezone,
            "intended_sec": intended_sec,
        }
        with _client() as client:
            response = client.post("/sessions", json=payload)
        return response.json()
  • server.py:27-27 (registration)
    Tool registration using @mcp.tool() decorator on the start_session function, which registers it with the FastMCP server instance.
    @mcp.tool()

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