Skip to main content
Glama
mrchris2000

MCP DevOps Plan Server

by mrchris2000

create_work_item

Create new work items in DevOps Plan systems by specifying title, description, type, application, and project to track development tasks.

Instructions

Creates a new work item in Plan

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
componentNoAn optional component name if any are available in the project, this is not required.
titleYesTitle of the work item
descriptionYesDescription of the work item
workItemTypeYesType of the work item from the list of available work item types
applicationYesName of the application
projectNameYesName of the project

Implementation Reference

  • The tool definition and handler logic for "create_work_item".
    server.tool(
        "create_work_item",
        "Creates a new work item in Plan",
        {
            component: z.string().optional().describe("An optional component name if any are available in the project, this is not required."),
            title: z.string().describe("Title of the work item"),
            description: z.string().describe("Description of the work item"),
            workItemType: z.string().describe("Type of the work item from the list of available work item types"),
            application: z.string().describe("Name of the application"),
            projectId: z.string().describe("ID of the project")
        },
        async ({component, title, description, workItemType, application, projectId }) => {
            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);
                }
                let bodyJSON = JSON.parse(createWorkItemBody);
                if(component !== undefined){
                    // Use empty string if not provided
                    bodyJSON.fields[0].value = component || "";
                    bodyJSON.fields[0].valueAsList[0] = component || "";
                } 
                bodyJSON.fields[2].value = projectId;
                bodyJSON.fields[2].valueAsList[0] = projectId;
                bodyJSON.fields[4].value = title;
                bodyJSON.fields[4].valueAsList[0] = title;
                bodyJSON.fields[5].value = description;
                bodyJSON.fields[5].valueAsList[0] = description;
                bodyJSON.fields[6].value = workItemType;
                bodyJSON.fields[6].valueAsList[0] = workItemType;
                let body = JSON.stringify(bodyJSON);
    
                const response = await fetch(`${serverURL}/ccmweb/rest/repos/${teamspaceID}/databases/${application}/records/WorkItem/?operation=Commit&useDbid=false`, {
                    method: 'POST',
                    headers: {
                        'Content-Type': 'application/json',
                        'Accept': 'application/json',
                        'Authorization': `Basic ${personal_access_token_string}`,
                        'Cookie': globalCookies
                    },
                    body: body
                });
    
                const data = await response.json();
                if (data.viewURL) {
                    return {
                        content: [{ type: 'text', text: `Work item created successfully. View it at: ${serverURL}/#${data.viewURL}` }]
                    };
                } else {
                    throw new Error("Failed to create work item");
                }
            } catch (e) {
                return {
                    content: [{ type: 'text', text: `Error creating work item: ${e.message}` }]
                };
            }
        }
    );
  • The JSON template used for creating a work item.
    const createWorkItemBody = `
    {
      "dbId": "33554505",
      "displayName": "string",
      "entityDefName": "Project",
      "fields": [
          {
          "name": "Component",
          "value": "",
          "valueStatus": "HAS_VALUE",
          "validationStatus": "_KNOWN_VALID",
          "requiredness": "READONLY",
          "requirednessForUser": "READONLY",
          "type": "REFERENCE",
          "valueAsList": [
            ""
          ],
          "messageText": "",
          "maxLength": 0
        },
        {
          "name": "dbid",
          "value": "33554505",
          "valueStatus": "HAS_VALUE",
          "validationStatus": "_KNOWN_VALID",
          "requiredness": "READONLY",
          "requirednessForUser": "READONLY",
          "type": "DBID",
          "valueAsList": [
            "33554505"
          ],
          "messageText": "",
          "maxLength": 0
        },
        {
          "name": "Project",
          "value": "Devops Code",
          "valueStatus": "HAS_VALUE",
          "validationStatus": "_KNOWN_VALID",
          "requiredness": "READONLY",
          "requirednessForUser": "READONLY",
          "type": "REFERENCE",
          "valueAsList": [
            "Devops Code"
          ],
          "messageText": "",
          "maxLength": 0
        },
        {
          "name": "record_type",
          "value": "WorkItem",
          "valueStatus": "HAS_VALUE",
          "validationStatus": "_KNOWN_VALID",
          "requiredness": "READONLY",
          "requirednessForUser": "READONLY",
          "type": "RECORDTYPE",
          "valueAsList": [
            "WorkItem"
          ],
          "messageText": "",
          "maxLength": 30
        },
        {
          "name": "Title",
          "value": "Plan Item",
          "valueStatus": "HAS_VALUE",
          "validationStatus": "_KNOWN_VALID",
          "requiredness": "READONLY",
          "requirednessForUser": "READONLY",
          "type": "SHORT_STRING",
          "valueAsList": [
            "Plan Item"
          ],
          "messageText": "",
          "maxLength": 254
        },
    	{
          "name": "Description",
          "value": "Plan Item",
          "valueStatus": "HAS_VALUE",
          "validationStatus": "_KNOWN_VALID",
          "requiredness": "READONLY",
          "requirednessForUser": "READONLY",
          "type": "MULTILINE_STRING",
          "valueAsList": [
            "Plan Item"
          ],
          "messageText": "",
          "maxLength": 0
        },
        {
          "name": "WIType",
          "value": "Task",
          "valueStatus": "HAS_VALUE",
          "validationStatus": "_KNOWN_VALID",
          "requiredness": "READONLY",
          "requirednessForUser": "READONLY",
          "type": "SHORT_STRING",
          "valueAsList": [
            "Task"
          ],
          "messageText": "",
          "maxLength": 254
        }
      ],
      "legalActions": [
        {
          "actionName": "Submit",
          "formDefName": "Defect_Base_Submit"
        }
      ],
      "isEditable": true,
      "isDuplicate": true,
      "original": {
        "dbId": "33554524",
        "displayName": "string",
        "entityDefName": "Project",
        "viewURL": "string"
      },
      "isOriginal": true,
      "hasDuplicates": true,
      "errorMessage": "string",
      "duplicates": [
        {
          "child": {
            "dbId": "33554524",
            "displayName": "string",
            "entityDefName": "Project",
            "viewURL": "string"
          },
          "parent": {
            "dbId": "33554524",
            "displayName": "string",
            "entityDefName": "Project",
            "viewURL": "string"
          }
        }
      ],
      "viewURL": "string"
    }

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