Parameters
| Parameter | Type | Description |
|---|---|---|
options.name | string | The name of the MCP server |
options.version | string | Optional version string |
options.instructions | string | Optional server instructions, returned from initialize and surfaced to the model as an MCP instructions block |
options.tools | Array<SdkMcpToolDefinition> | Array of tool definitions created with tool() |
options.alwaysLoad | boolean | When true, every tool from this server stays in the initial prompt and is never deferred behind tool search. Combines with per-tool alwaysLoad in tool() |
options.timeout | number | Timeout in milliseconds for this server's tool calls. Claude Code applies it to this server in place of MCP_TOOL_TIMEOUT. Pass a whole number of at least 1000. Claude Code ignores other values. Requires TypeScript Agent SDK v0.3.248 or later |
listSessions()
Discovers and lists past sessions with light metadata. Filter by project directory or list sessions across all projects.
typescript
function listSessions(options?: ListSessionsOptions): Promise<SDKSessionInfo[]>;