get_sprints
Retrieve the list of sprints for a specific application in DevOps Plan systems to track development cycles and project progress.
Instructions
Get the list of sprints in Plan for a given application
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| application | Yes | Name of the application |
Implementation Reference
- src/lib/server.js:379-464 (handler)The implementation of the `get_sprints` tool, which queries the Plan server for sprints.
server.tool( "get_sprints", "Get the list of sprints in Plan for a given application", { application: z.string().describe("Name of the application") }, async ({ application }) => { try { if (!globalCookies) { globalCookies = await getCookiesFromServer(serverURL); if (!globalCookies) { console.error("Failed to retrieve cookies from server."); return { error: "Failed to retrieve cookies." }; } console.log("Received Cookies:", globalCookies); } else { console.log("Reusing Stored Cookies:", globalCookies); } const queryPayload = { queryDef: { primaryEntityDefName: "Sprint", queryFieldDefs: [ { fieldPathName: "Name", isShown: true, sortOrder: 0 }, { fieldPathName: "StartDate", isShown: true, sortOrder: 0 }, { fieldPathName: "EndDate", isShown: true, sortOrder: 0 }, { fieldPathName: "dbid", isShown: true, sortOrder: 0 }, { fieldPathName: "record_type", isShown: true, sortOrder: 0 } ], filterNode: { boolOp: "BOOL_OP_AND", fieldFilters: [], childFilterNodes: [] } }, resultSetOptions: { convertToLocalTime: false, maxResultSetRows: 10000, pageSize: 10000 } }; const queryResponse = await fetch(`${serverURL}/ccmweb/rest/repos/${teamspaceID}/databases/${application}/query`, { method: 'POST', headers: { 'Content-Type': 'application/json', 'Authorization': `Basic ${personal_access_token_string}`, 'Cookie': globalCookies }, body: JSON.stringify(queryPayload) , ...getAgentOptions(serverURL) }); const queryData = await queryResponse.json(); const resultSetId = queryData.result_set_id; if (!resultSetId) { throw new Error(`Failed to retrieve result set ID. Response: ${JSON.stringify(queryData)}`); } const sprintsResponse = await fetch(`${serverURL}/ccmweb/rest/repos/${teamspaceID}/databases/${application}/query/${resultSetId}`, { method: 'GET', headers: { 'Content-Type': 'application/json', 'Authorization': `Basic ${personal_access_token_string}`, 'Cookie': globalCookies } , ...getAgentOptions(serverURL) }); const sprintsData = await sprintsResponse.json(); if (sprintsData && sprintsData.rows) { return { content: [{ type: 'text', text: `Sprints retrieved: ${JSON.stringify(sprintsData)}` }] }; } else { throw new Error("Failed to retrieve sprints"); } } catch (e) { return { content: [{ type: 'text', text: `Error retrieving sprints: ${e.message}` }] }; } } )