Skip to main content
Glama
kunwarVivek

mcp-github-project-manager

create_label

Create a new label in GitHub projects to categorize issues and pull requests by specifying name, color, and optional description.

Instructions

Create a new GitHub label

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
nameYes
colorYes
descriptionNo

Implementation Reference

  • Core handler function that executes the create_label tool by calling GitHub GraphQL API to create a repository label with name, color, and optional description.
    async createLabel(data: {
      name: string;
      color: string;
      description?: string;
    }): Promise<{ id: string; name: string; color: string; description: string }> {
      try {
        const mutation = `
          mutation($input: CreateLabelInput!) {
            createLabel(input: $input) {
              label {
                id
                name
                color
                description
              }
            }
          }
        `;
    
        interface CreateLabelResponse {
          createLabel: {
            label: {
              id: string;
              name: string;
              color: string;
              description: string;
            }
          }
        }
    
        const response = await this.factory.graphql<CreateLabelResponse>(mutation, {
          input: {
            repositoryId: this.factory.getConfig().repo,
            name: data.name,
            color: data.color,
            description: data.description || ''
          }
        });
    
        return response.createLabel.label;
      } catch (error) {
        throw this.mapErrorToMCPError(error);
      }
    }
  • Zod schema defining input validation for create_label tool: name (required string), color (6-digit hex), description (optional).
    export const createLabelSchema = z.object({
      name: z.string().min(1, "Label name is required"),
      color: z.string().regex(/^[0-9a-fA-F]{6}$/, "Color must be a valid 6-digit hex color code without #"),
      description: z.string().optional(),
    });
    
    export type CreateLabelArgs = z.infer<typeof createLabelSchema>;
  • MCP tool dispatching switch case that routes create_label calls to ProjectManagementService.createLabel(args).
    case "create_label":
      return await this.service.createLabel(args);
  • ToolRegistry registers createLabelTool (imported from ToolSchemas.ts) making it available for MCP list_tools and call_tool.
    this.registerTool(createLabelTool);
  • ToolDefinition for create_label including name, description, input schema reference, and usage example.
    export const createLabelTool: ToolDefinition<CreateLabelArgs> = {
      name: "create_label",
      description: "Create a new GitHub label",
      schema: createLabelSchema as unknown as ToolSchema<CreateLabelArgs>,
      examples: [
        {
          name: "Create bug label",
          description: "Create a red bug label",
          args: {
            name: "bug",
            color: "ff0000",
            description: "Something isn't working"
          }
        }
      ]
    };
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/kunwarVivek/mcp-github-project-manager'

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