Skip to main content
Glama

List sessions

listSessions

List sessions within a specified time range using pagination and optional environment filter to organize and access session data.

Instructions

List sessions within a time range.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
pageNoPage number (default 1)
limitNoItems per page (default 50, max 100)
fromTimestampNoISO 8601 lower bound (inclusive)
toTimestampNoISO 8601 upper bound (exclusive)
environmentNo

Implementation Reference

  • src/tools.ts:78-90 (registration)
    Tool registration for 'listSessions' with title, description, and input schema (pagination, time range, environment).
    server.registerTool(
      "listSessions",
      {
        title: "List sessions",
        description: "List sessions within a time range.",
        inputSchema: {
          ...paginationShape,
          ...timeRangeShape,
          environment: z.string().optional(),
        },
      },
      async (args) => asJson(await client.get("/api/public/sessions", args)),
    );
  • Handler function that calls the Langfuse API GET /api/public/sessions with the provided arguments.
    async (args) => asJson(await client.get("/api/public/sessions", args)),
  • Input schema for listSessions: pagination (page, limit), time range (fromTimestamp, toTimestamp), and optional environment filter.
    inputSchema: {
      ...paginationShape,
      ...timeRangeShape,
      environment: z.string().optional(),
    },
  • Helper function that wraps data in the MCP content format as JSON text.
    const asJson = (data: unknown) => ({
      content: [{ type: "text" as const, text: JSON.stringify(data, null, 2) }],
    });
    
    const enc = encodeURIComponent;
    
    export function registerTools(server: McpServer, client: LangfuseClient): void {
      // ---------- Traces ----------
      server.registerTool(
        "listTraces",
        {
          title: "List traces",
  • src/tools.ts:397-420 (registration)
    Entry in TOOL_NAMES constant array for the listSessions tool.
      "listSessions",
      "getSession",
      "listScores",
      "getScore",
      "listScoreConfigs",
      "getScoreConfig",
      "listPrompts",
      "getPrompt",
      "listDatasets",
      "getDataset",
      "listDatasetItems",
      "getDatasetItem",
      "listDatasetRuns",
      "getDatasetRun",
      "getMetrics",
      "getDailyMetrics",
      "listModels",
      "getModel",
      "listProjects",
      "listComments",
      "getComment",
      "getMedia",
      "getHealth",
    ] as const;
Behavior2/5

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

No annotations are provided, so the description must fully disclose behavioral traits. It only states the action but omits key details: no mention of read-only nature, response size, or behavior when no time range is specified (all parameters are optional). The description adds minimal value beyond the tool name.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness3/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single sentence of five words, which is very concise. However, conciseness should not sacrifice essential information. It fails to mention pagination or optionality, making it slightly under-specified. It earns its place but could be improved.

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?

For a list tool with 5 parameters, no output schema, and no annotations, the description is incomplete. It does not explain that all parameters are optional, how pagination works, or the default behavior when no time range is given. The agent lacks critical context for correct invocation.

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?

Schema description coverage is 80% (4 of 5 parameters have descriptions). The description's mention of 'time range' reinforces the from/to timestamps, but adds no extra meaning to parameters like page, limit, or environment. Given high schema coverage, a score of 3 is appropriate.

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 verb 'list' and resource 'sessions' are clear. The phrase 'within a time range' immediately indicates the primary filter, distinguishing it from other list tools like listProjects or listComments. However, it does not clarify whether sessions are from a specific system or context, which is minor.

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 compared to other list tools or alternatives like getSession. It does not specify prerequisites, limitations, or preferred scenarios. The agent must infer usage from the name alone.

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/hugoles/langfuse-mcp'

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