list_devin_sessions
Retrieve and manage Devin sessions on the MCP-Devin server, enabling efficient tracking and organization of AI interactions within Slack. Supports pagination via limit and offset inputs.
Instructions
List all Devin sessions
Tool call template
This tool declares no required parameters. Add optional parameters from the input schema as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {},
"name": "list_devin_sessions"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| limit | No | Maximum number of sessions to return | |
| offset | No | Number of sessions to skip |
Implementation Reference
- src/index.ts:540-597 (handler)Handler for the 'list_devin_sessions' tool. Fetches the list of Devin sessions from the API endpoint `${BASE_URL}/session` with optional pagination parameters (limit, offset). Normalizes session IDs by stripping 'devin-' prefix and handles errors appropriately.
case "list_devin_sessions": { const limit = Number(request.params.arguments?.limit) || undefined; const offset = Number(request.params.arguments?.offset) || undefined; try { const params: Record<string, any> = {}; if (limit !== undefined) params.limit = limit; if (offset !== undefined) params.offset = offset; const response = await axios.get( `${BASE_URL}/session`, { params, headers: getHeaders() } ); // セッション一覧の各セッションIDを正規化する const normalizedData = { ...response.data }; if (normalizedData.sessions && Array.isArray(normalizedData.sessions)) { normalizedData.sessions = normalizedData.sessions.map((session: { session_id?: string; [key: string]: any }) => { if (session.session_id) { return { ...session, original_session_id: session.session_id, session_id: normalizeSessionId(session.session_id) }; } return session; }); } return { content: [{ type: "text", text: JSON.stringify(normalizedData, null, 2) }] }; } catch (error) { if (axios.isAxiosError(error)) { return { content: [{ type: "text", text: `Error listing sessions: ${error.response?.status} - ${JSON.stringify(error.response?.data)}` }], isError: true }; } return { content: [{ type: "text", text: `Unexpected error: ${error}` }], isError: true }; } } - src/index.ts:172-188 (schema)Tool schema definition including name, description, and input schema for pagination (limit and offset). This is part of the tools list returned by ListToolsRequestHandler.
{ name: "list_devin_sessions", description: "List all Devin sessions", inputSchema: { type: "object", properties: { limit: { type: "number", description: "Maximum number of sessions to return" }, offset: { type: "number", description: "Number of sessions to skip" } } } }, - src/index.ts:57-59 (helper)Helper function used in the handler to normalize session IDs by removing the 'devin-' prefix.
function normalizeSessionId(sessionId: string): string { return sessionId.replace(/^devin-/, ''); }