Skip to main content
Glama

add_item_to_project_v2

Add GitHub issues or pull requests to a project V2 by specifying the project and content node IDs using the GraphQL API, streamlining project management workflows.

Instructions

Add an issue or pull request to a GitHub project V2 using GraphQL API

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
contentIdYesThe node ID of the issue or pull request to add
projectIdYesThe node ID of the project

Implementation Reference

  • The core handler function that performs the GraphQL mutation to add an item (issue or PR) to a ProjectV2.
    export async function addItemToProjectV2(projectId: string, contentId: string) {
      try {
        const query = `
          mutation($input: AddProjectV2ItemByIdInput!) {
            addProjectV2ItemById(input: $input) {
              item {
                id
                content {
                  ... on Issue {
                    id
                    title
                    number
                  }
                  ... on PullRequest {
                    id
                    title
                    number
                  }
                }
              }
            }
          }
        `;
    
        const variables = {
          input: {
            projectId,
            contentId
          }
        };
    
        const response = await graphqlRequest(query, variables);
    
        return response.data.addProjectV2ItemById.item;
      } catch (error) {
        if (error instanceof GitHubError) {
          throw error;
        }
    
        throw new GitHubError(
          `Failed to add item to project v2: ${(error as Error).message}`,
          500,
          { error: (error as Error).message }
        );
      }
  • Zod schema defining the input parameters: projectId and contentId.
    export const AddItemToProjectV2Schema = z.object({
      projectId: z.string().describe("The node ID of the project"),
      contentId: z.string().describe("The node ID of the issue or pull request to add")
    });
  • index.ts:290-294 (registration)
    Tool registration in the MCP server's listTools response, specifying name, description, and input schema.
    {
      name: "add_item_to_project_v2",
      description: "Add an issue or pull request to a GitHub project V2 using GraphQL API",
      inputSchema: zodToJsonSchema(projectsV2.AddItemToProjectV2Schema),
    },
  • Dispatcher case in the callTool handler that parses arguments and invokes the main handler function.
    case "add_item_to_project_v2": {
      const args = projectsV2.AddItemToProjectV2Schema.parse(request.params.arguments);
      const result = await projectsV2.addItemToProjectV2(
        args.projectId,
        args.contentId
      );
      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 the full burden. It states it's an 'Add' operation (implying mutation) but doesn't disclose behavioral traits like required permissions, whether it's idempotent, rate limits, error conditions, or what happens on success (e.g., returns an item ID). 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, efficient sentence with zero waste. It front-loads the core action and resource, and every word ('using GraphQL API') adds relevant context without redundancy.

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, no output schema, and 2 parameters, the description is incomplete. It lacks behavioral context (e.g., permissions, side effects), usage guidelines, and output details, making it inadequate for safe and effective use by 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 100%, with clear descriptions for both parameters ('contentId' as node ID of issue/PR, 'projectId' as node ID of project). The description adds no additional meaning beyond the schema, such as format examples or constraints, but the schema is comprehensive, meeting the baseline for high coverage.

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') and the resource ('an issue or pull request to a GitHub project V2'), specifying the API type ('GraphQL API'). It distinguishes from siblings like 'add_card_to_column' (which targets columns) and 'create_project_v2' (which creates projects), but doesn't explicitly contrast with 'update_project_v2_item_field' (which modifies fields).

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 node IDs), exclusions (e.g., not for adding non-issue/PR items), or comparisons to siblings like 'add_card_to_column' (for project V1) or 'update_project_v2_item_field' (for modifying 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

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