Skip to main content
Glama
kunwarVivek

mcp-github-project-manager

create_project_field

Add custom fields to GitHub projects to organize tasks with specific data types like text, numbers, dates, or selections.

Instructions

Create a custom field for a GitHub project

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
projectIdYes
nameYes
typeYes
optionsNo
descriptionNo
requiredNo

Implementation Reference

  • Executes the GitHub GraphQL mutation 'createProjectV2Field' to create a custom field in a GitHub project, handling different field types including single_select with options and iteration fields with config. Fetches additional details post-creation.
    async createField(projectId: ProjectId, field: Omit<CustomField, "id">): Promise<CustomField> {
      const mutation = `
        mutation($input: CreateProjectV2FieldInput!) {
          createProjectV2Field(input: $input) {
            projectV2Field {
              id
              name
              dataType
            }
          }
        }
      `;
    
      try {
        const githubFieldType = mapToGraphQLFieldType(field.type);
        
        const variables: any = {
          input: {
            projectId,
            dataType: githubFieldType,
            name: field.name,
          }
        };
    
        if (field.type === 'single_select' && field.options && field.options.length > 0) {
          variables.input.singleSelectOptions = field.options.map(option => ({
            name: option.name,
            description: option.description || null,
            color: option.color || null
          }));
        }
    
        if (field.type === 'iteration' && field.config) {
          if (field.config.iterationDuration) {
            variables.input.iterationDuration = field.config.iterationDuration;
          }
          if (field.config.iterationStart) {
            variables.input.iterationStartDate = field.config.iterationStart;
          }
        }
    
        const response = await this.graphql<CreateProjectV2FieldResponse>(mutation, variables);
        const createdField = response.createProjectV2Field.projectV2Field;
    
        // Since the createdField object doesn't have a dataType property, we need to fetch it
        const fieldDetails = await this.getField(projectId, createdField.id);
        
        return {
          id: createdField.id,
          name: createdField.name,
          type: fieldDetails?.type || field.type, // Use fetched type or fallback to original
          options: field.options || [],
          description: field.description,
          required: field.required || false,
          defaultValue: field.defaultValue,
          validation: field.validation,
          config: field.config
        };
      } catch (error) {
        this.logger.error(`Failed to create field ${field.name} for project ${projectId}`, error);
        throw this.handleGraphQLError(error);
      }
    }
  • Zod schema defining input parameters for the create_project_field tool: projectId, name, type (text/number/date/single_select/iteration/milestone/assignees/labels), optional options array, description, and required flag.
    export const createProjectFieldSchema = z.object({
      projectId: z.string().min(1, "Project ID is required"),
      name: z.string().min(1, "Field name is required"),
      type: z.enum([
        "text",
        "number",
        "date",
        "single_select",
        "iteration",
        "milestone",
        "assignees",
        "labels"
      ]),
      options: z.array(
        z.object({
          name: z.string().min(1),
          description: z.string().optional(),
          color: z.string().optional(),
        })
      ).optional(),
      description: z.string().optional(),
      required: z.boolean().optional(),
    });
    
    export type CreateProjectFieldArgs = z.infer<typeof createProjectFieldSchema>;
  • ToolDefinition object registering the create_project_field tool with name, description, input schema, and example usage for creating a status single-select field.
    export const createProjectFieldTool: ToolDefinition<CreateProjectFieldArgs> = {
      name: "create_project_field",
      description: "Create a custom field for a GitHub project",
      schema: createProjectFieldSchema as unknown as ToolSchema<CreateProjectFieldArgs>,
      examples: [
        {
          name: "Create status field",
          description: "Create a status dropdown field for a project",
          args: {
            projectId: "PVT_kwDOLhQ7gc4AOEbH",
            name: "Status",
            type: "single_select",
            options: [
              { name: "To Do", color: "red" },
              { name: "In Progress", color: "yellow" },
              { name: "Done", color: "green" }
            ],
            description: "Current status of the task",
            required: true
          }
        }
      ]
    };
  • Registers the createProjectFieldTool in the central ToolRegistry singleton during built-in tools initialization.
    this.registerTool(createProjectFieldTool);
Behavior2/5

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

No annotations are provided, so the description carries the full burden of behavioral disclosure. While 'create' implies a write operation, the description doesn't mention permissions required, whether it's idempotent, rate limits, or what happens on success/failure. It lacks critical context for a mutation tool with no annotation coverage.

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, clear sentence with no wasted words. It's front-loaded with the core purpose and efficiently communicates the essential action without unnecessary elaboration.

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?

For a mutation tool with 6 parameters, 0% schema coverage, no annotations, and no output schema, the description is inadequate. It doesn't explain parameter usage, behavioral traits, or expected outcomes, leaving significant gaps for an AI agent to invoke it correctly.

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?

Schema description coverage is 0%, meaning none of the 6 parameters are documented in the schema. The description adds no information about parameters beyond what's implied by the tool name (e.g., it mentions 'custom field' but doesn't explain what 'projectId,' 'type,' 'options,' etc., mean or how they should be used).

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 action ('create') and resource ('custom field for a GitHub project'), making the purpose immediately understandable. It doesn't specifically differentiate from sibling tools like 'update_project_field' or 'list_project_fields,' but the verb 'create' distinguishes it from update/list operations.

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 (like needing a project ID), when not to use it, or how it differs from related tools like 'update_project_field' or 'list_project_fields' in the sibling list.

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/kunwarVivek/mcp-github-project-manager'

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