Skip to main content
Glama

get_session_history

Read-onlyIdempotent

Retrieves paginated message history from a durable session record, including user and assistant messages with attachment metadata, so you can review prior conversation context.

Instructions

Message history of a session, read from the durable record and paginated with before/limit/next_before (user/assistant messages only; attachments as metadata) — see below

Tool call template

Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {
      "session_id": "<session_id>"
    },
    "name": "get_session_history"
  }
}

Input Schema

NameRequiredDescriptionDefault
limitNoMessages per page, newest before the cursor; defaults to 50, maximum 100
beforeNoPagination cursor: use the previous page's next_before value unchanged
session_idYesSession ID returned by chat_with_agent or list_agent_sessions

Output Schema

NameRequiredDescriptionDefault
successNo
agent_idNo
messagesNo
session_idNo
message_countNo
messages_before_cursorNo

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed3 schema fields changedv2.2.4
    • changedInput schema / properties / before / description
      Previous value: -"Cursor de paginação: o next_before devolvido pela página anterior (não altere o valor)"New value: +"Pagination cursor: use the previous page's next_before value unchanged"
    • changedInput schema / properties / limit / description
      Previous value: -"Mensagens por página (default 50, max 100) — as mais recentes antes do cursor"New value: +"Messages per page, newest before the cursor; defaults to 50, maximum 100"
    • changedInput schema / properties / session_id / description
      Previous value: -"ID da sessão (retornado por chat_with_agent ou list_agent_sessions)"New value: +"Session ID returned by chat_with_agent or list_agent_sessions"
  2. Changed3 schema fields changedv2.2.3
    • addedInput schema / properties / before
      Added value: +{
      +  "description": "Cursor de paginação: o next_before devolvido pela página anterior (não altere o valor)",
      +  "type": "string"
      +}
    • addedInput schema / properties / limit
      Added value: +{
      +  "description": "Mensagens por página (default 50, max 100) — as mais recentes antes do cursor",
      +  "maximum": 100,
      +  "minimum": 1,
      +  "type": "integer"
      +}
    • changedOutput schema / (root)
      Previous value: -nullNew value: +{
      +  "additionalProperties": true,
      +  "anyOf": [
      +    {
      +      "required": [
      +        "success",
      +        "session_id",
      +        "messages"
      +      ]
      +    },
      +    {
      +      "properties": {
      +        "error": {
      +          "additionalProperties": true,
      +          "properties": {
      +            "code": {
      +              "type": "string"
      +            },
      +            "message": {
      +              "type": "string"
      +            }
      +          },
      +          "required": [
      +            "code",
      +            "message"
      +          ],
      +          "type": "object"
      +        },
      +        "success": {
      +          "const": false
      +        }
      +      },
      +      "required": [
      +        "success",
      +        "error"
      +      ],
      +      "type": "object"
      +    }
      +  ],
      +  "properties": {
      +    "agent_id": {
      +      "type": [
      +        "string",
      +        "null"
      +      ]
      +    },
      +    "message_count": {
      +      "type": [
      +        "integer",
      +        "null"
      +      ]
      +    },
      +    "messages": {
      +      "items": {
      +        "additionalProperties": true,
      +        "properties": {
      +          "blocks": {
      +            "type": "array"
      +          },
      +          "content": {},
      +          "content_from_blocks": {
      +            "type": "boolean"
      +          },
      +          "id": {},
      +          "role": {
      +            "type": "string"
      +          },
      +          "timestamp": {}
      +        },
      +        "required": [
      +          "role"
      +        ],
      +        "type": "object"
      +      },
      +      "type": "array"
      +    },
      +    "messages_before_cursor": {
      +      "type": [
      +        "integer",
      +        "null"
      +      ]
      +    },
      +    "session_id": {
      +      "type": "string"
      +    },
      +    "success": {
      +      "type": "boolean"
      +    }
      +  },
      +  "type": "object"
      +}
  3. First observedv0.1.0

TDQS

A3.7/5.0
Behavior4/5

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

Annotations already cover read-only, idempotent, non-destructive, and closed-world behavior. The description adds useful context beyond that: history comes from a durable record, pagination uses before/limit/next_before, only user and assistant messages are included, and attachments appear as metadata.

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

Conciseness4/5

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

The description is a single front-loaded sentence with little waste. It is dense but every clause contributes useful scope or pagination information; the external link is a minor addition rather than filler.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the output schema and full parameter coverage, the definition supplies enough context to call the tool correctly. It describes the source, content scope, and pagination model, though ordering guidance or explicit sibling alternatives would make it more complete.

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 100%, so the input schema already documents all three parameters. The description reinforces the pagination parameters but adds no syntax or constraint beyond what the schema provides.

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 description states a specific resource and operation: the message history of a session, read from the durable record and paginated. It makes the scope clear but does not explicitly name sibling tools such as list_agent_history, so it stops short of full sibling differentiation.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

It implies the tool is used to retrieve a session's message history and explains the pagination mechanics. However, it gives no explicit when-not-to-use guidance and does not route the agent toward or away from sibling history tools.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Deploy Server

Other Tools