Skip to main content
Glama

create_label

Create GitHub labels to organize issues and pull requests by adding color-coded tags with descriptions for better project management.

Instructions

Create a new GitHub label

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
nameYes
colorYes
descriptionNo

Implementation Reference

  • Core handler implementation that uses GitHub GraphQL API to create a new repository label with the given 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 the create_label tool: name (required string), color (6-digit hex), description (optional string).
    // Schema for create_label tool
    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>;
  • Registers the createLabelTool in the central ToolRegistry during initialization.
    // Register label tools
    this.registerTool(createLabelTool);
    this.registerTool(listLabelsTool);
  • ToolDefinition object that defines the create_label tool's metadata, schema reference, and usage examples for registration.
    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"
          }
        }
      ]
    };
  • MCP server dispatch handler that routes create_label tool calls to the ProjectManagementService.createLabel method.
    case "create_label":
      return await this.service.createLabel(args);
Behavior2/5

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

With no annotations provided, the description carries the full burden of behavioral disclosure. It states 'Create a new GitHub label' which implies a write operation, but doesn't disclose permissions needed, rate limits, whether it's idempotent, or what happens on duplicate names. For a mutation tool with zero annotation coverage, this is a significant gap in transparency.

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

Conciseness5/5

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

The description is a single, efficient sentence with zero wasted words. It's appropriately sized for a simple creation tool and front-loads the essential information. Every word earns its place in conveying the core purpose.

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 this is a mutation tool with 3 parameters, 0% schema description coverage, no annotations, and no output schema, the description is incomplete. It doesn't explain what the tool returns, error conditions, or behavioral details needed for safe invocation. The description alone is insufficient for an agent to use this tool effectively.

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

Parameters2/5

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

The schema description coverage is 0%, so the description must compensate but provides no parameter information. It doesn't explain what 'name', 'color', or 'description' parameters represent, their formats (e.g., color as hex code), or constraints. With 3 parameters and no schema descriptions, the description adds no semantic value beyond what's inferred from the tool name.

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 verb ('Create') and resource ('GitHub label'), making the purpose immediately understandable. It distinguishes from sibling tools like 'list_labels' by specifying creation rather than listing. However, it doesn't explicitly differentiate from other creation tools like 'create_issue' or 'create_milestone' beyond the resource type.

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?

The description provides no guidance on when to use this tool versus alternatives. There's no mention of prerequisites (e.g., repository access), when not to use it (e.g., for existing labels), or comparisons to sibling tools like 'update_issue' for modifying labels. Usage is implied but not explicitly stated.

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/HarshKumarSharma/MCP'

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