Skip to main content
Glama

add_project_item

Add issues or pull requests to GitHub projects to organize development work and track implementation progress.

Instructions

Add an item to a GitHub project

Input Schema

NameRequiredDescriptionDefault
projectIdYes
contentIdYes
contentTypeYes

Input Schema (JSON Schema)

{ "properties": { "contentId": { "type": "string" }, "contentType": { "enum": [ "issue", "pull_request" ] }, "projectId": { "type": "string" } }, "required": [ "projectId", "contentId", "contentType" ], "type": "object" }

Implementation Reference

  • Core handler function that executes the tool logic using GitHub GraphQL API mutation 'addProjectV2ItemById' to add an issue or pull request to a project.
    async addProjectItem(data: { projectId: string; contentId: string; contentType: 'issue' | 'pull_request'; }): Promise<ProjectItem> { try { // GraphQL mutation to add an item to a project const mutation = ` mutation($input: AddProjectV2ItemByIdInput!) { addProjectV2ItemById(input: $input) { item { id content { ... on Issue { id title } ... on PullRequest { id title } } } } } `; interface AddProjectItemResponse { addProjectV2ItemById: { item: { id: string; content: { id: string; title: string; }; }; }; } const response = await this.factory.graphql<AddProjectItemResponse>(mutation, { input: { projectId: data.projectId, contentId: data.contentId } }); const itemId = response.addProjectV2ItemById.item.id; const contentId = response.addProjectV2ItemById.item.content.id; const resourceType = data.contentType === 'issue' ? ResourceType.ISSUE : ResourceType.PULL_REQUEST; return { id: itemId, contentId, contentType: resourceType, projectId: data.projectId, fieldValues: {}, createdAt: new Date().toISOString(), updatedAt: new Date().toISOString() }; } catch (error) { throw this.mapErrorToMCPError(error); } }
  • Zod schema defining input validation for the tool: projectId, contentId, and contentType (issue or pull_request). Includes TypeScript type inference.
    // Schema for add_project_item tool export const addProjectItemSchema = z.object({ projectId: z.string().min(1, "Project ID is required"), contentId: z.string().min(1, "Content ID is required"), contentType: z.enum(["issue", "pull_request"]), }); export type AddProjectItemArgs = z.infer<typeof addProjectItemSchema>;
  • Registers the addProjectItemTool in the central ToolRegistry singleton instance.
    this.registerTool(addProjectItemTool);
  • Imports the addProjectItemTool from ToolSchemas for registration.
    addProjectItemTool,
  • Dispatcher in main server that routes tool calls to ProjectManagementService.addProjectItem.
    case "add_project_item": return await this.service.addProjectItem(args);

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/HarshKumarSharma/MCP'

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