Skip to main content
Glama

create_project_field

Add custom fields to GitHub projects to track specific data types like text, numbers, dates, or selections for better organization and workflow management.

Instructions

Create a custom field for a GitHub project

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
projectIdYes
nameYes
typeYes
optionsNo
descriptionNo
requiredNo

Implementation Reference

  • Core handler function that executes the GitHub GraphQL 'createProjectV2Field' mutation to create a custom field in a project. Matches the tool arguments perfectly (projectId, name, type, options, etc.).
    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 the input parameters and validation for the create_project_field tool.
    // Schema for create_project_field tool
    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>;
  • Registration of the createProjectFieldTool in the central ToolRegistry singleton.
    // Register project field tools
    this.registerTool(createProjectFieldTool);
    this.registerTool(listProjectFieldsTool);
    this.registerTool(updateProjectFieldTool);
  • ToolDefinition export containing name, description, schema reference, and examples for MCP tool listing.
    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
          }
        }
      ]
    };
Behavior2/5

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

With no annotations provided, the description carries full burden for behavioral disclosure. It states 'Create' which implies a write/mutation operation, but doesn't disclose permission requirements, rate limits, whether the operation is idempotent, what happens on failure, or the response format. This is a significant gap for a mutation tool with zero 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 zero wasted words. It's appropriately sized for a basic tool definition and front-loads the essential information (create custom field). Every word earns its place.

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 what the tool returns, error conditions, or behavioral aspects. The description should provide more context about the creation operation, parameter meanings, and expected outcomes.

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?

With 0% schema description coverage for 6 parameters, the description provides no parameter information beyond what's inferred from the tool name. It doesn't explain what 'projectId', 'name', 'type', 'options', 'description', or 'required' mean, their formats, constraints, or relationships. The description fails to compensate for the complete lack of schema documentation.

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 ('a custom field for a GitHub project'), making the purpose immediately understandable. It distinguishes from siblings like 'update_project_field' by specifying creation rather than modification, though it doesn't explicitly contrast with 'list_project_fields' or other field-related tools.

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. It doesn't mention prerequisites (e.g., needing an existing project), when not to use it (e.g., for updating existing fields), or direct alternatives like 'update_project_field' for modifications or 'list_project_fields' for viewing existing fields.

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