Home / Servers / OpenAI API / list_agent_sessions

List agent sessions

An MCP tool from the OpenAI API server, hosted on mcp.hjlabs.in.

List agent sessions Lists managed agent sessions using ID-based pagination and the requested sort order. See managing sessions. [GET /agents/sessions]

Name on the gateway: openai_api__list_agent_sessions · read-only.

Parameters

NameTypeDescription
limitintegerThe maximum number of resources to return, between 1 and 100. Defaults to 20.
orderasc | descThe order in which resources are returned. Defaults to desc.
afterstringReturn resources after this resource ID in the selected order.
agent_idstringOnly return sessions whose root agent has this ID. Omit to return sessions for…
metadataobjectExact string matches supplied as metadata[key]=value. All supplied pairs must…

How to call it

Through the Smart Gateway, any client can run it by name with call_tool, or let the gateway find it with search_tools:

call_tool arguments
{
  "name": "openai_api__list_agent_sessions",
  "arguments": {}
}

Or connect the OpenAI API server directly, which lists 371 tools including this one:

Run in your terminal
claude mcp add --transport http hj-openai-api https://mcp.hjlabs.in/mcp/openai-api \
  --header "Authorization: Bearer YOUR_API_KEY"

Try asking

Use the list agent sessions tool with limit set to ….

More from OpenAI API