Skip to main content
Glama

add_issue_to_project

Add existing GitHub issues to Project V2 for better organization and tracking. Connect issues from any repository to your project workflow.

Instructions

Add an existing GitHub issue to a Project V2.

Args:
    owner: The GitHub organization or user name that owns the project
    project_number: The project number
    issue_owner: The owner of the repository containing the issue
    issue_repo: The repository name containing the issue
    issue_number: The issue number

Returns:
    A formatted string confirming the addition

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
ownerYes
project_numberYes
issue_ownerYes
issue_repoYes
issue_numberYes

Implementation Reference

  • MCP tool handler for 'add_issue_to_project'. Registers the tool via @mcp.tool(), defines input schema via type hints and docstring, executes by calling GitHubClient helper, and formats response.
    @mcp.tool()
    async def add_issue_to_project(
        owner: str,
        project_number: int,
        issue_owner: str,
        issue_repo: str,
        issue_number: int,
    ) -> str:
        """Add an existing GitHub issue to a Project V2.
    
        Args:
            owner: The GitHub organization or user name that owns the project
            project_number: The project number
            issue_owner: The owner of the repository containing the issue
            issue_repo: The repository name containing the issue
            issue_number: The issue number
    
        Returns:
            A formatted string confirming the addition
        """
        try:
            result = await github_client.add_issue_to_project(
                owner, project_number, issue_owner, issue_repo, issue_number
            )
            return (
                f"Successfully added issue {issue_owner}/{issue_repo}#{issue_number} to project #{project_number}!\n"
                f"Item ID: {result['id']}"
            )
        except GitHubClientError as e:
            logger.error(
                f"Error adding issue {issue_owner}/{issue_repo}#{issue_number} to project {owner}/{project_number}: {e}"
            )
            return f"Error: Could not add issue to project. Details: {e}"
  • Core implementation in GitHubClient: fetches project and issue node IDs, then executes GraphQL mutation 'addProjectV2ItemById' to add the issue to the project.
    async def add_issue_to_project(
        self,
        owner: str,
        project_number: int,
        issue_owner: str,
        issue_repo: str,
        issue_number: int,
    ) -> Dict[str, Any]:
        """Add an existing GitHub issue to a Project V2.
    
        Args:
            owner: The GitHub organization or user name that owns the project
            project_number: The project number
            issue_owner: The owner of the repository containing the issue
            issue_repo: The repository name containing the issue
            issue_number: The issue number
    
        Returns:
            The project item data
    
        Raises:
            GitHubClientError: If project or issue is not found, or adding fails.
        """
        # Get project ID
        try:
            project_id = await self.get_project_node_id(owner, project_number)
        except GitHubClientError as e:
            logger.error(f"Cannot add issue: {e}")
            raise
    
        # Get issue ID
        issue_query = """
        query GetIssueId($owner: String!, $repo: String!, $number: Int!) {
          repository(owner: $owner, name: $repo) {
            issue(number: $number) {
              id
            }
          }
        }
        """
    
        issue_variables = {
            "owner": issue_owner,
            "repo": issue_repo,
            "number": issue_number,
        }
    
        try:
            issue_result = await self.execute_query(issue_query, issue_variables)
            if not issue_result.get("repository") or not issue_result["repository"].get(
                "issue"
            ):
                raise GitHubClientError(
                    f"Issue {issue_number} not found in {issue_owner}/{issue_repo}"
                )
        except GitHubClientError as e:
            logger.error(
                f"Failed to get issue ID for {issue_owner}/{issue_repo}#{issue_number}: {e}"
            )
            raise
    
        issue_id = issue_result["repository"]["issue"]["id"]
    
        # Add issue to project
        add_query = """
        mutation AddItemToProject($projectId: ID!, $contentId: ID!) {
          addProjectV2ItemById(input: {
            projectId: $projectId,
            contentId: $contentId
          }) {
            item {
              id
              content {
                ... on Issue {
                  title
                  number
                }
                ... on PullRequest {
                  title
                  number
                }
              }
            }
          }
        }
        """
    
        variables = {"projectId": project_id, "contentId": issue_id}
    
        try:
            result = await self.execute_query(add_query, variables)
            if not result.get("addProjectV2ItemById") or not result[
                "addProjectV2ItemById"
            ].get("item"):
                raise GitHubClientError(
                    f"Failed to add issue {issue_number} to project {project_number}"
                )
            return result["addProjectV2ItemById"]["item"]
        except GitHubClientError as e:
            logger.error(
                f"Failed to add issue {issue_number} to project {project_number}: {e}"
            )
            raise
Behavior2/5

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

With no annotations provided, the description carries full burden but lacks critical behavioral details. It mentions the tool adds an existing issue but doesn't disclose permissions needed, rate limits, whether it's idempotent, or what happens if the issue is already in the project. The return value is vaguely described as 'a formatted string confirming the addition' without specifics.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is appropriately sized and front-loaded with the core purpose in the first sentence. The Args and Returns sections are structured clearly, though the return description could be more specific. No wasted sentences, but minor improvements in detail could enhance clarity.

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 no annotations, no output schema, and 5 parameters with 0% schema coverage, the description is incomplete. It covers the basic action and parameters but misses behavioral context (e.g., auth, errors), output details, and usage guidelines relative to siblings. For a mutation tool with multiple parameters, this leaves significant gaps for an AI agent.

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 0%, so the description must compensate. It lists all 5 parameters with brief explanations (e.g., 'owner: The GitHub organization or user name that owns the project'), adding basic semantics beyond the schema's titles. However, it doesn't clarify relationships (e.g., 'owner' vs 'issue_owner') or provide examples, leaving gaps in understanding.

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 ('Add an existing GitHub issue to a Project V2') with specific resources (GitHub issue, Project V2), distinguishing it from siblings like 'create_issue' (creates new) or 'delete_project_item' (removes). However, it doesn't explicitly differentiate from 'update_project_item_field' which might modify project items, leaving some ambiguity.

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 like 'create_draft_issue' or 'update_project_item_field', nor does it mention prerequisites (e.g., issue must exist, user must have permissions). It only states what the tool does without context for selection.

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