update_session
Modify an exploratory session by sending only the fields to change. Update name, mission, assignee, tags, and more.
Instructions
Modify an existing exploratory session. Send only the fields you want to change inside the updates object. Requires write permission. Allowed fields: name, mission, sessionType, config, environment, releaseId, assigneeUserId, state, estimate, tags, linkedIssues, attachments. Findings are not editable here. updates.assigneeUserId accepts either a User _id or an email address. IMPORTANT: updates.tags must be a JSON array of strings — e.g. ["exploratory","auth"] — NOT a comma-separated string.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| projectId | Yes | Project ID (required). | |
| sessionId | Yes | Internal _id or counter-style ID (required). | |
| updates | Yes | Fields to update: name, mission, sessionType, config, environment, releaseId, assigneeUserId, state, estimate, tags, linkedIssues, attachments. |
Implementation Reference
- Main handler function for the update_session tool. Validates inputs (projectId, sessionId, updates), retrieves the API key, constructs the PATCH URL via endpoints.updateSession(), and sends the request via apiRequestJson with Bearer token auth. Returns the response as text content or throws an error on failure.
export async function handleUpdateSession(args?: UpdateSessionArgs) { const token = getApiKey(args); if (!token) { throw new Error( "Missing TESTDINO_PAT environment variable. Configure it in your .cursor/mcp.json under 'env'." ); } if (!args?.projectId) throw new Error("projectId is required"); if (!args?.sessionId) throw new Error("sessionId is required"); if (!args?.updates || typeof args.updates !== "object") { throw new Error("updates must be an object containing fields to modify"); } try { const url = endpoints.updateSession( String(args.projectId), String(args.sessionId) ); const response = await apiRequestJson<unknown>(url, { method: "PATCH", headers: { Authorization: `Bearer ${token}` }, body: { updates: args.updates }, }); return { content: [{ type: "text", text: JSON.stringify(response, null, 2) }], }; } catch (error) { const msg = error instanceof Error ? error.message : String(error); throw new Error(`Failed to update session: ${msg}`); } } - TypeScript interface defining the input arguments: projectId (string), sessionId (string), and updates (Record<string, unknown>).
interface UpdateSessionArgs { projectId: string; sessionId: string; updates: Record<string, unknown>; } - Tool definition object with name 'update_session', description, and inputSchema (JSON Schema) requiring projectId, sessionId, and updates as an object.
export const updateSessionTool = { name: "update_session", description: 'Modify an existing exploratory session. Send only the fields you want to change inside the `updates` object. Requires write permission. Allowed fields: name, mission, sessionType, config, environment, releaseId, assigneeUserId, state, estimate, tags, linkedIssues, attachments. Findings are not editable here. updates.assigneeUserId accepts either a User _id or an email address. IMPORTANT: updates.tags must be a JSON array of strings — e.g. ["exploratory","auth"] — NOT a comma-separated string.', inputSchema: { type: "object", properties: { projectId: { type: "string", description: "Project ID (required)." }, sessionId: { type: "string", description: "Internal _id or counter-style ID (required).", }, updates: { type: "object", description: "Fields to update: name, mission, sessionType, config, environment, releaseId, assigneeUserId, state, estimate, tags, linkedIssues, attachments.", }, }, required: ["projectId", "sessionId", "updates"], }, }; - src/index.ts:343-347 (registration)Tool routing in the MCP CallToolRequestSchema handler: when name === 'update_session', it calls handleUpdateSession with the parsed args.
if (name === "update_session") { return await handleUpdateSession( args as Parameters<typeof handleUpdateSession>[0] ); } - src/index.ts:129-129 (registration)Tool listing registration: updateSessionTool is included in the tools array sent in response to ListToolsRequestSchema.
updateSessionTool,