Skip to main content
Glama
wkoutre

Linear MCP Server

by wkoutre

linear_getWorkflowStates

Retrieve workflow states for a Linear team to understand project statuses and manage issue progression.

Instructions

Get workflow states for a team

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
teamIdYesID of the team to get workflow states for
includeArchivedNoWhether to include archived states (default: false)

Implementation Reference

  • Handler function that implements the core logic of the linear_getWorkflowStates tool. Validates arguments using type guard and delegates to LinearService.getWorkflowStates.
    /**
     * Handler for getting workflow states for a team
     */
    export function handleGetWorkflowStates(linearService: LinearService) {
      return async (args: unknown) => {
        try {
          if (!isGetWorkflowStatesArgs(args)) {
            throw new Error("Invalid arguments for getWorkflowStates");
          }
          
          return await linearService.getWorkflowStates(
            args.teamId, 
            args.includeArchived || false
          );
        } catch (error) {
          logError("Error getting workflow states", error);
          throw error;
        }
      };
  • MCP tool definition specifying name, description, input_schema (teamId required, includeArchived optional boolean), and output_schema for workflow state objects.
     */
    export const getWorkflowStatesToolDefinition: MCPToolDefinition = {
      name: "linear_getWorkflowStates",
      description: "Get workflow states for a team",
      input_schema: {
        type: "object",
        properties: {
          teamId: {
            type: "string",
            description: "ID of the team to get workflow states for",
          },
          includeArchived: {
            type: "boolean",
            description: "Whether to include archived states (default: false)",
          },
        },
        required: ["teamId"],
      },
      output_schema: {
        type: "array",
        items: {
          type: "object",
          properties: {
            id: { type: "string" },
            name: { type: "string" },
            type: { type: "string" },
            position: { type: "number" },
            color: { type: "string" },
            description: { type: "string" }
          }
        }
      }
    }; 
  • Registration of the linear_getWorkflowStates handler within the registerToolHandlers function's return object.
    linear_getTeams: handleGetTeams(linearService),
    linear_getWorkflowStates: handleGetWorkflowStates(linearService),
  • Type guard helper function used by the handler to validate input arguments for teamId (string, required) and includeArchived (boolean, optional).
     * Type guard for linear_getWorkflowStates tool arguments
     */
    export function isGetWorkflowStatesArgs(args: unknown): args is {
      teamId: string;
      includeArchived?: boolean;
    } {
      if (
        typeof args !== "object" ||
        args === null ||
        !("teamId" in args) ||
        typeof (args as { teamId: string }).teamId !== "string"
      ) {
        return false;
      }
    
      if (
        "includeArchived" in args &&
        typeof (args as { includeArchived: boolean }).includeArchived !== "boolean"
      ) {
        return false;
      }
    
      return true;
    } 
  • Inclusion of the linear_getWorkflowStates tool definition in the allToolDefinitions array for overall tool registration.
    // Team tools
    getTeamsToolDefinition,
    getWorkflowStatesToolDefinition,

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/wkoutre/linear-mcp-server'

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