(sessions)
Operations related to sessions
- sessions - Returns a list of
Sessionobjects.
Returns a list of Session objects.
import { OpalMcp } from "opal-mcp";
const opalMcp = new OpalMcp({
bearerAuth: process.env["OPALMCP_BEARER_AUTH"] ?? "",
});
async function run() {
const result = await opalMcp.sessions.sessions({
resourceId: "1b978423-db0a-4037-a4cf-f79c60cb67b3",
userId: "32acc112-21ff-4669-91c2-21e27683eaa1",
});
console.log(result);
}
run();The standalone function version of this method:
import { OpalMcpCore } from "opal-mcp/core.js";
import { sessionsSessions } from "opal-mcp/funcs/sessionsSessions.js";
// Use `OpalMcpCore` for best tree-shaking performance.
// You can create one instance of it to use across an application.
const opalMcp = new OpalMcpCore({
bearerAuth: process.env["OPALMCP_BEARER_AUTH"] ?? "",
});
async function run() {
const res = await sessionsSessions(opalMcp, {
resourceId: "1b978423-db0a-4037-a4cf-f79c60cb67b3",
userId: "32acc112-21ff-4669-91c2-21e27683eaa1",
});
if (res.ok) {
const { value: result } = res;
console.log(result);
} else {
console.log("sessionsSessions failed:", res.error);
}
}
run();| Parameter | Type | Required | Description |
|---|---|---|---|
request |
operations.SessionsRequest | ✔️ | The request object to use for the request. |
options |
RequestOptions | ➖ | Used to set various options for making HTTP requests. |
options.fetchOptions |
RequestInit | ➖ | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All Request options, except method and body, are allowed. |
options.retries |
RetryConfig | ➖ | Enables retrying HTTP requests under certain failure conditions. |
Promise<components.SessionsList>
| Error Type | Status Code | Content Type |
|---|---|---|
| errors.APIError | 4XX, 5XX | */* |