Skip to main content
Glama
orchestra-hq

Orchestra MCP Server

Official
by orchestra-hq

Read an agent session's messages

get_agent_session_history_messages
Read-only

Read a page of an agent session's messages, a whole number of complete turns at a time, oldest first. Pass exactly one of before_sequence_id or after_sequence_id.

Instructions

Read a page of an agent session's messages, a whole number of complete turns at a time, oldest first. Pass exactly one of before_sequence_id or after_sequence_id. Every message carries a sequenceId of the form <unix-milliseconds>-<counter>, and sequence IDs order as strings. So before_sequence_id set to the current time in milliseconds reads the latest turns, and after_sequence_id=0 reads from the start of the session. Page back with nextBeforeSequenceId while hasPreviousPage is true, and forward with nextAfterSequenceId while hasNextPage is true. A turn still in progress is left out until it completes. Returns 404 for a session the caller cannot see, and 403 for one whose agent the caller cannot view. A session started by a user in the Orchestra UI is visible to that user alone, so an API key never sees one. Sessions started for a task run or an incident are visible to everyone in the workspace who can view the agent.

Input Schema

NameRequiredDescriptionDefault
session_idYesAgent session ID.
turn_limitNoNumber of turns per page. Defaults to 3; maximum 10.
after_sequence_idNoReturn the turns that start after this sequence ID, i.e. page forward in time. Cannot be combined with `before_sequence_id`.
before_sequence_idNoReturn the turns that end before this sequence ID, i.e. page back in time. Cannot be combined with `after_sequence_id`.
X-Orchestra-Account-IdNoAct on this account rather than the one the credential resolves to. Omit it to use the credential's own account. An API key is issued to a single account, so it may only name that account; an OAuth token may name any account its grant covers.

Output Schema

NameRequiredDescriptionDefault

No arguments

Schema Changelog

Changes observed during successful MCP inspections.

  1. Addedv2026.10.12-0

TDQS

A4.5/5.0
Behavior5/5

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

Annotations only supply readOnlyHint=true, but the description adds real behavioral context: an in-progress turn is omitted until it completes, 404/403 error semantics, and detailed visibility rules (UI-started sessions are private to the user, so API keys never see them; task-run/incident sessions are workspace-wide). This goes well beyond what annotations provide.

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?

Front-loaded with the purpose, then pagination mechanics, then error/visibility behavior. It is dense but every sentence carries actionable information; no filler, though the pagination walkthrough is long enough to border on verbose.

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

Completeness5/5

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

An output schema exists, so return values need not be spelled out, and the description covers the remaining gaps: pagination direction, cursor construction, incomplete-turn handling, and full authorization/visibility semantics. Nothing an agent needs to call this correctly is missing.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 100%, so the baseline is 3. The description adds genuine interpretation not in the schema: sequence IDs are '<unix-ms>-<counter>' and order as strings, which explains why before_sequence_id=current-time reads the newest turns and after_sequence_id=0 starts at the beginning.

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?

States a specific verb and resource: 'Read a page of an agent session's messages', plus the scope (whole complete turns, oldest first). It is unambiguous what the tool returns, though it never names or contrasts a sibling tool (e.g. get_agent_session, list_agent_sessions) to anchor its place in the family.

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

Usage Guidelines5/5

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

Gives explicit operating guidance: pass exactly one of before/after_sequence_id, set before_sequence_id to the current time in ms to read the latest turns, use after_sequence_id=0 to read from the start, and page with nextBeforeSequenceId/nextAfterSequenceId gated on hasPreviousPage/hasNextPage. This is effectively a usage manual for the tool.

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