Skip to main content
Glama

update_project_v2_item_field

Modify field values for items in GitHub Projects V2 using the GraphQL API. Specify project, item, and field IDs to update and assign new values effectively.

Instructions

Update a field value for an item in a GitHub project V2 using GraphQL API

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
fieldIdYesThe node ID of the field
itemIdYesThe node ID of the item
projectIdYesThe node ID of the project
valueNoThe new value for the field

Implementation Reference

  • The core handler function that executes the GraphQL mutation to update a ProjectV2 item field value, handling different value types (text, date, single select, number).
    export async function updateProjectV2ItemFieldValue(projectId: string, itemId: string, fieldId: string, value: any) {
      try {
        const query = `
          mutation($input: UpdateProjectV2ItemFieldValueInput!) {
            updateProjectV2ItemFieldValue(input: $input) {
              projectV2Item {
                id
              }
            }
          }
        `;
    
        // Phân tích kiểu giá trị để tạo input phù hợp
        let fieldValue;
    
        if (typeof value === 'string') {
          // Text field
          fieldValue = { text: value };
        } else if (value instanceof Date) {
          // Date field
          fieldValue = { date: value.toISOString() };
        } else if (typeof value === 'object' && value.optionId) {
          // Single select field
          fieldValue = { singleSelectOptionId: value.optionId };
        } else if (typeof value === 'number') {
          // Number field
          fieldValue = { number: value };
        } else {
          throw new GitHubError(
            `Unsupported field value type`,
            400,
            { error: 'Unsupported field value type' }
          );
        }
    
        const variables = {
          input: {
            projectId,
            itemId,
            fieldId,
            value: fieldValue
          }
        };
    
        const response = await graphqlRequest(query, variables);
    
        return response.data.updateProjectV2ItemFieldValue.projectV2Item;
      } catch (error) {
        if (error instanceof GitHubError) {
          throw error;
        }
    
        throw new GitHubError(
          `Failed to update project v2 item field value: ${(error as Error).message}`,
          500,
          { error: (error as Error).message }
        );
      }
    } 
  • Zod schema defining the input parameters: projectId, itemId, fieldId, and value for the update_project_v2_item_field tool.
    export const UpdateProjectV2ItemFieldValueSchema = z.object({
      projectId: z.string().describe("The node ID of the project"),
      itemId: z.string().describe("The node ID of the item"),
      fieldId: z.string().describe("The node ID of the field"),
      value: z.any().describe("The new value for the field")
    });
  • index.ts:300-304 (registration)
    Tool registration in the MCP server's listTools response, specifying name, description, and input schema.
    {
      name: "update_project_v2_item_field",
      description: "Update a field value for an item in a GitHub project V2 using GraphQL API",
      inputSchema: zodToJsonSchema(projectsV2.UpdateProjectV2ItemFieldValueSchema),
    }
  • MCP server handler that parses tool arguments and delegates to the projectsV2.updateProjectV2ItemFieldValue function.
    case "update_project_v2_item_field": {
      const args = projectsV2.UpdateProjectV2ItemFieldValueSchema.parse(request.params.arguments);
      const result = await projectsV2.updateProjectV2ItemFieldValue(
        args.projectId,
        args.itemId,
        args.fieldId,
        args.value
      );
      return {
        content: [{ type: "text", text: JSON.stringify(result, null, 2) }],
      };
    }
Behavior2/5

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

No annotations are provided, so the description carries full burden. It states this is an update operation, implying mutation, but doesn't disclose behavioral traits like required permissions, whether changes are reversible, rate limits, or what happens on success/failure. 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 waste—it states the action, target, and API method without redundancy. It's appropriately sized and front-loaded, making it easy for an agent to parse quickly.

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 no annotations and no output schema, the description is incomplete. It doesn't explain what the tool returns, error conditions, or behavioral context like side effects. For a 4-parameter tool that modifies data, more detail is needed to guide the agent effectively.

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

Parameters3/5

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

Schema description coverage is 100%, so the schema already documents all four parameters (projectId, itemId, fieldId, value) with clear descriptions. The description adds no additional meaning beyond implying these IDs are for GraphQL nodes, which aligns with the schema. Baseline 3 is appropriate when the schema does the heavy lifting.

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 ('Update a field value') and the target resource ('for an item in a GitHub project V2'), specifying it uses the GraphQL API. It distinguishes from siblings like 'update_issue' or 'update_project_v2' by focusing on item fields, though it doesn't explicitly contrast with similar tools like 'update_project_v2'.

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?

No guidance is provided on when to use this tool versus alternatives. It doesn't mention prerequisites (e.g., needing existing project, item, and field IDs), exclusions, or how it differs from siblings like 'update_project_v2' or 'add_item_to_project_v2', leaving the agent to infer usage from the name alone.

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

Related 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/tuanle96/mcp-github'

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