Skip to main content
Glama
mrchris2000

MCP DevOps Plan Server

by mrchris2000

get_work_items

Retrieve work items for applications and projects, with options to filter by work item type or specific owner.

Instructions

Retrieves all work items for a given application, can filter by work item type and specific owner

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
applicationNameYesName of the application
projectNameYesName of the project
workitemTypeNoType of the work item to filter by, if any
ownerNoFilter the workitems by owner, if any

Implementation Reference

  • Implementation of the "get_work_items" tool. It retrieves work items from a given Plan application, filtered by project, optional work item type, and optional owner. It performs a POST query to get a result set and then a GET request to retrieve the items.
    server.tool(
        "get_work_items",
        "Retrieves all work items for a given application, can filter by work item type and specific owner",
        {
            applicationName: z.string().describe("Name of the application"),
            projectId: z.string().describe("ID of the project"),
            workitemType: z.string().optional().describe("Type of the work item to filter by, if any"),
            owner: z.string().optional().describe("Filter the workitems by owner, if any")
        },
        async ({ applicationName, projectId, workitemType, owner }) => {
            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); // Print cookies after receiving
                } else {
                    console.log("Reusing Stored Cookies:", globalCookies); // Print when reusing stored cookies
                }
                console.log(`${serverURL}/ccmweb/rest/repos/${teamspaceID}/databases/${applicationName}/query`);
                // First API call to get result_set_id
                const queryPayload = {
                    queryDef: {
                        primaryEntityDefName: "WorkItem",
                        stateDriven: true,
                        showWipLimits: true,
                        backlogStateName:"Backlog",
                        laneQueryDef: {
                            pageCounterQueryField: "State",
                            pageCounterQueryFieldPath: "State",
                            wipLimitFilterQueryField: "Project"
                        },
                        primaryEntityDefName: "WorkItem",
                        queryFieldDefs: [
                            { fieldPathName: "dbid", isShown: true },
                            { fieldPathName: "State", isShown: true },
                            { fieldPathName: "id", isShown: true },
                            { fieldPathName: "Title", isShown: true },
                            { fieldPathName: "Owner.fullname", isShown: true },
                            { fieldPathName: "Owner", isShown: true },
                            { fieldPathName: "Priority", isShown: true },
                            { fieldPathName: "Parent.Title", isShown: true },
                            { fieldPathName: "Parent", isShown: true },
                            { fieldPathName: "Parent.record_type", isShown: true },
                            { fieldPathName: "Tags", isShown: true },
                            { fieldPathName: "WIType", isShown: true },
                            { fieldPathName: "State", isShown: true }
                        ],
                        filterNode: {
                            boolOp: "BOOL_OP_AND",
                            fieldFilters: [
                                { fieldPath: "Project", compOp: "COMP_OP_EQ", values: [projectId] },
                                ...(owner ? [{ fieldPath: "Owner", compOp: "COMP_OP_EQ", values: ["[CURRENT_USER]"] }] : []),
                                ...(workitemType ? [{ fieldPath: "WIType", compOp: "COMP_OP_EQ", values: [workitemType] }] : [])
                            ]
                        }
                    },
                    resultSetOptions: {
                        pageSize: 300,
                        convertToLocalTime: true
                    }
                };
    
                const queryResponse = await fetch(`${serverURL}/ccmweb/rest/repos/${teamspaceID}/databases/${applicationName}/query`, {
                    method: 'POST',
                    headers: {
                        'Content-Type': 'application/json',
                        'Authorization': `Basic ${personal_access_token_string}`,
                        'Cookie': globalCookies
                    },
                    body: JSON.stringify(queryPayload)
                });
    
                const queryData = await queryResponse.json();
                const resultSetId = queryData.result_set_id;
    
                if (!resultSetId) {
                    throw new Error("Failed to retrieve result set ID");
                }
    
                // Second API call to fetch work items
                const workItemsResponse = await fetch(`${serverURL}/ccmweb/rest/repos/${teamspaceID}/databases/${applicationName}/query/${resultSetId}?pageNumber=1`, {
                    method: 'GET',
                    headers: {
                        'Content-Type': 'application/json',
                        'Authorization': `Basic ${personal_access_token_string}`,
                        'Cookie': globalCookies
                    }
                });
    
                const workItemsData = await workItemsResponse.json();
    
                if (workItemsData) {
                    return {
                        content: [{ type: 'text', text: `Work items retrieved: ${JSON.stringify(workItemsData)}` }]
                    };
                } else {
                    throw new Error("Failed to retrieve work items");
                }
            } catch (e) {
                return {
                    content: [{ type: 'text', text: `Error retrieving work items: ${e.message}` }]
                };
            }
        }
    );
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries full disclosure burden. While 'Retrieves' implies a read-only operation, there is no information about return format, pagination behavior, authentication requirements, or what happens when no items match the filters. The agent gets no behavioral context beyond the basic operation type.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness3/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single sentence and appropriately concise, but the omission of the required 'projectName' parameter suggests it may be too compressed. The information is front-loaded but incomplete regarding the full input requirements.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given no output schema and no annotations, the description should provide more context. It fails to mention that both application and project are required identifiers (only mentions application), provides no return value documentation, and lacks error condition handling. For a 4-parameter retrieval tool with required scoping parameters, this is insufficient.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

With 100% schema description coverage, the baseline is appropriately met. The description mentions filtering by 'work item type' and 'specific owner' which maps to the schema parameters. However, it completely omits mention of 'projectName' despite it being a required parameter alongside 'applicationName', which is a notable gap even with complete schema coverage.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool retrieves work items with specific filtering capabilities (by type and owner). It uses a specific verb ('Retrieves') and identifies the resource ('work items'). However, it doesn't explicitly distinguish this from sibling getters like 'get_available_workitem_types' or mention that both application AND project are required scopes.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

There is no guidance on when to use this tool versus alternatives like 'get_available_workitem_types' (for metadata) versus actual work items. No mention of prerequisites such as needing valid application/project names from sibling tools first, or when to use filtering versus retrieving all items.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/mrchris2000/mcp-devops-plan'

If you have feedback or need assistance with the MCP directory API, please join our Discord server