Skip to main content
Glama

delete_project_item

Remove an item from a GitHub Project V2 by specifying the owner, project number, and item ID to clean up project boards and manage workflows.

Instructions

Delete an item from a GitHub Project V2.

Args:
    owner: The GitHub organization or user name
    project_number: The project number
    item_id: The ID of the item to delete

Returns:
    A confirmation message

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
ownerYes
project_numberYes
item_idYes

Implementation Reference

  • The primary MCP tool handler for 'delete_project_item'. Decorated with @mcp.tool() for registration. Validates inputs via type hints and docstring, delegates to GitHubClient, handles errors, and formats response.
    @mcp.tool()
    async def delete_project_item(owner: str, project_number: int, item_id: str) -> str:
        """Delete an item from a GitHub Project V2.
    
        Args:
            owner: The GitHub organization or user name
            project_number: The project number
            item_id: The ID of the item to delete
    
        Returns:
            A confirmation message
        """
        try:
            deleted_item_id = await github_client.delete_project_item(
                owner, project_number, item_id
            )
            return (
                f"Successfully deleted item from project #{project_number}!\n"
                f"Deleted Item ID: {deleted_item_id}"
            )
        except GitHubClientError as e:
            logger.error(
                f"Error deleting item {item_id} from project {project_number}: {e}"
            )
            return f"Error: Could not delete item. Details: {e}"
  • Supporting method in GitHubClient class that performs the actual GraphQL mutation to delete the project item via GitHub's API.
    async def delete_project_item(
        self, owner: str, project_number: int, item_id: str
    ) -> str:
        """Delete an item from 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
    
        Returns:
            The ID of the deleted item.
    
        Raises:
            GitHubClientError: If project not found or deletion fails.
        """
        # Get project ID
        try:
            project_id = await self.get_project_node_id(owner, project_number)
        except GitHubClientError as e:
            logger.error(f"Cannot delete item: {e}")
            raise
    
        # Delete item
        delete_query = """
        mutation DeleteProjectItem($projectId: ID!, $itemId: ID!) {
          deleteProjectV2Item(input: {
            projectId: $projectId,
            itemId: $itemId
          }) {
            deletedItemId
          }
        }
        """
    
        variables = {"projectId": project_id, "itemId": item_id}
    
        try:
            result = await self.execute_query(delete_query, variables)
            if not result.get("deleteProjectV2Item") or not result[
                "deleteProjectV2Item"
            ].get("deletedItemId"):
                raise GitHubClientError(f"Failed to delete item {item_id}")
            return result["deleteProjectV2Item"]["deletedItemId"]
        except GitHubClientError as e:
            logger.error(f"Failed to delete item {item_id}: {e}")
            raise
  • The @mcp.tool() decorator registers this function as an MCP tool.
    @mcp.tool()
  • Docstring and type annotations define the input schema (parameters) and output for the MCP tool.
    """Delete an item from a GitHub Project V2.
    
    Args:
        owner: The GitHub organization or user name
        project_number: The project number
        item_id: The ID of the item to delete
    
    Returns:
        A confirmation message
    """

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