Skip to main content
Glama

update_project_item_field

Modify field values for items in GitHub Projects to keep project data current and organized.

Instructions

Update a field value for a project item.

Args:
    owner: The GitHub organization or user name
    project_number: The project number
    item_id: The ID of the item to update
    field_id: The ID of the field to update
    field_value: The new value for the field (text, date, or option ID for single select)

Returns:
    A confirmation message

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
ownerYes
project_numberYes
item_idYes
field_idYes
field_valueYes

Implementation Reference

  • MCP tool handler for 'update_project_item_field'. Decorated with @mcp.tool() for registration. Handles input parameters, basic value parsing, calls the GitHub client method, and returns formatted response.
    async def update_project_item_field(
        owner: str, project_number: int, item_id: str, field_id: str, field_value: str
    ) -> str:
        """Update a field value for a project item.
    
        Args:
            owner: The GitHub organization or user name
            project_number: The project number
            item_id: The ID of the item to update
            field_id: The ID of the field to update
            field_value: The new value for the field (text, date, or option ID for single select)
    
        Returns:
            A confirmation message
        """
        try:
            # The GitHub client's update method expects the raw value, not just string
            # We might need a way to parse field_value based on field_id or context
            # For now, we pass the string directly, but this might fail for non-text fields.
            # A better implementation would fetch field info first to determine expected type.
            logger.warning(
                f"Attempting to update field {field_id} with value '{field_value}'. Type conversion might be needed."
            )
    
            # Attempt basic type inference (example - needs improvement)
            parsed_value: Any = field_value
            try:
                parsed_value = float(field_value)
                if parsed_value.is_integer():
                    parsed_value = int(parsed_value)
            except ValueError:
                # Check if looks like a date?
                pass  # Keep as string if not obviously numeric
    
            result = await github_client.update_project_item_field(
                owner,
                project_number,
                item_id,
                field_id,
                parsed_value,  # Pass potentially parsed value
            )
            return (
                f"Successfully updated field for item in project #{project_number}!\n"
                f"Item ID: {item_id}\n"
                f"Field ID: {field_id}\n"
                f"Value Set: {field_value}"  # Report the value as passed to the tool
            )
        except GitHubClientError as e:
            logger.error(f"Error updating field {field_id} for item {item_id}: {e}")
            return f"Error: Could not update field value. Details: {e}"
  • Core implementation in GitHubClient class. Determines field type from ID prefix, constructs appropriate GraphQL input value, executes mutation to updateProjectV2ItemFieldValue.
    async def update_project_item_field(
        self,
        owner: str,
        project_number: int,
        item_id: str,
        field_id: str,
        value: Any,  # Value type depends on the field
    ) -> Dict[str, Any]:
        """Update a field value for an item in a GitHub Project V2.
    
        Args:
            owner: The GitHub organization or user name that owns the project
            project_number: The project number
            item_id: The project item ID
            field_id: The field ID to update
            value: The new value (type depends on field: string, number, date, boolean, iteration ID, single select option ID)
    
        Returns:
            The updated project item data (containing the item ID)
    
        Raises:
            GitHubClientError: If project not found or update fails.
        """
        # Get project ID
        try:
            project_id = await self.get_project_node_id(owner, project_number)
        except GitHubClientError as e:
            logger.error(f"Cannot update item field: {e}")
            raise
    
        # Prepare value based on its type and field ID convention
        # This mapping might need refinement based on actual field types fetched separately
        field_value_input: Dict[str, Any] = {}
    
        # Heuristic based on ID prefix - A better approach would be to fetch field type first
        if field_id.startswith("PVTSSF_"):  # Single Select Field (assumed prefix)
            if isinstance(value, str):
                field_value_input = {"singleSelectOptionId": value}
            else:
                raise GitHubClientError(
                    f"Invalid value type for single select field {field_id}. Expected option ID string."
                )
        elif field_id.startswith("PVTIF_"):  # Iteration Field (assumed prefix)
            if isinstance(value, str):
                field_value_input = {"iterationId": value}
            else:
                raise GitHubClientError(
                    f"Invalid value type for iteration field {field_id}. Expected iteration ID string."
                )
        # Add more field types based on prefixes or fetched field info
        elif field_id.startswith("PVTF_"):  # Text Field (assumed prefix)
            if isinstance(value, str):
                field_value_input = {"text": value}
            else:  # Attempt to convert
                field_value_input = {"text": str(value)}
        elif field_id.startswith("PVTDF_"):  # Date Field (assumed prefix)
            if isinstance(value, str):  # Assuming date string like YYYY-MM-DD
                field_value_input = {"date": value}
            else:
                raise GitHubClientError(
                    f"Invalid value type for date field {field_id}. Expected date string (YYYY-MM-DD)."
                )
        elif field_id.startswith("PVTNU_"):  # Number Field (assumed prefix)
            if isinstance(value, (int, float)):
                field_value_input = {
                    "number": float(value)
                }  # GraphQL uses Float for numbers
            else:
                raise GitHubClientError(
                    f"Invalid value type for number field {field_id}. Expected int or float."
                )
        else:  # Default to text if type unknown
            logger.warning(
                f"Unknown field type for {field_id}. Attempting to set as text."
            )
            field_value_input = {"text": str(value)}
    
        # Update field value
        update_query = """
        mutation UpdateProjectFieldValue($projectId: ID!, $itemId: ID!, $fieldId: ID!, $value: ProjectV2FieldValue!) {
          updateProjectV2ItemFieldValue(input: {
            projectId: $projectId,
            itemId: $itemId,
            fieldId: $fieldId,
            value: $value
          }) {
            projectV2Item {
              id
            }
          }
        }
        """
    
        variables = {
            "projectId": project_id,
            "itemId": item_id,
            "fieldId": field_id,
            "value": field_value_input,
        }
    
        try:
            result = await self.execute_query(update_query, variables)
            if not result.get("updateProjectV2ItemFieldValue") or not result[
                "updateProjectV2ItemFieldValue"
            ].get("projectV2Item"):
                raise GitHubClientError(
                    f"Failed to update field value for item {item_id}"
                )
            return result["updateProjectV2ItemFieldValue"]["projectV2Item"]
        except GitHubClientError as e:
            logger.error(f"Failed to update field {field_id} for item {item_id}: {e}")
            raise
  • Input schema and documentation defined in the tool handler docstring, specifying parameters and their types.
    """Update a field value for a project item.
    
    Args:
        owner: The GitHub organization or user name
        project_number: The project number
        item_id: The ID of the item to update
        field_id: The ID of the field to update
        field_value: The new value for the field (text, date, or option ID for single select)
    
    Returns:
        A confirmation message
  • The @mcp.tool() decorator registers the function as an MCP tool.
    @mcp.tool()
    async def update_project_item_field(
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. It states this is an update operation but doesn't cover critical aspects like required permissions, whether changes are reversible, rate limits, or error handling. The description adds minimal behavioral context beyond the basic action.

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 well-structured and front-loaded with the core purpose, followed by clear parameter explanations in a bullet-like format. Every sentence adds value: the first states the action, and the subsequent lines clarify parameter semantics efficiently. There's no wasted text.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the complexity (5 parameters, no annotations, no output schema), the description is moderately complete. It covers parameter meanings but lacks behavioral details (e.g., permissions, side effects) and output specifics beyond 'A confirmation message'. For a mutation tool with no structured support, this leaves gaps in guiding the agent.

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

Parameters4/5

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

The description adds significant value beyond the input schema, which has 0% description coverage. It explains the purpose of each parameter (e.g., 'owner: The GitHub organization or user name') and provides crucial details like 'field_value' accepting 'text, date, or option ID for single select'. This compensates well for the schema's lack of descriptions.

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 tool's purpose: 'Update a field value for a project item.' It specifies the verb ('update') and resource ('field value for a project item'), making it easy to understand what the tool does. However, it doesn't explicitly differentiate from sibling tools like 'delete_project_item' or 'get_project_fields' beyond the 'update' action.

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 item), exclusions, or comparisons to siblings like 'add_issue_to_project' or 'create_issue'. The agent must infer usage from the tool name and parameters 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

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/Arclio/github-projects-mcp'

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