Skip to main content
Glama
mrchris2000

MCP DevOps Plan Server

by mrchris2000

get_available_states

Retrieve available state transitions for work items in a DevOps Plan application to understand permissible workflow actions.

Instructions

Gets the state transition matrix for work items in Plan for a given application, showing available transitions/actions

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
applicationYesName of the application

Implementation Reference

  • The registration and handler implementation of the "get_available_states" tool, which queries available states for work items via a REST API.
    // Tool to get available states for work items
    server.tool(
        "get_available_states",
        "Gets the available states for work items 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 response = await fetch(`${serverURL}/ccmweb/rest/repos/${teamspaceID}/databases/${application}/workspace/queryDefs/WorkItem/fieldOptions/state`, {
                    method: 'GET',
                    headers: {
                        'Content-Type': 'application/json',
                        'Authorization': `Basic ${personal_access_token_string}`,
                        'Cookie': globalCookies
                    }
                });
    
                if (!response.ok) {
                    const errorText = await response.text();
                    throw new Error(`Failed to get available states with status ${response.status}: ${errorText}`);
                }
    
                const data = await response.json();
                
                return {
                    content: [{ type: 'text', text: `Available states: ${JSON.stringify(data)}` }]
                };
            } catch (e) {
                return {
                    content: [{ type: 'text', text: `Error retrieving available states: ${e.message}` }]
                };
            }
        }
    );

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