update_project_field
Modify custom fields in GitHub projects, including updating names, descriptions, options, and required status, to streamline project management workflows.
Instructions
Update a custom field in a GitHub project
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| description | No | ||
| fieldId | Yes | ||
| name | No | ||
| options | No | ||
| projectId | Yes | ||
| required | No |
Implementation Reference
- The main handler function that executes the tool logic. Prepares the update data from input arguments and delegates to the GitHubProjectRepository to perform the actual API update.async updateProjectField(data: { projectId: string; fieldId: string; name?: string; options?: Array<{ name: string; color?: string; }>; }): Promise<CustomField> { try { const updateData: Partial<CustomField> = {}; if (data.name !== undefined) { updateData.name = data.name; } if (data.options !== undefined) { updateData.options = data.options.map(option => ({ id: '', // This will be assigned by GitHub name: option.name, color: option.color })); } return await this.projectRepo.updateField(data.projectId, data.fieldId, updateData); } catch (error) { throw this.mapErrorToMCPError(error); } }
- Zod schema defining the input validation for the update_project_field tool.// Schema for update_project_field tool export const updateProjectFieldSchema = z.object({ projectId: z.string().min(1, "Project ID is required"), fieldId: z.string().min(1, "Field ID is required"), name: z.string().optional(), description: z.string().optional(), options: z.array( z.object({ id: z.string().optional(), name: z.string().min(1), description: z.string().optional(), color: z.string().optional(), }) ).optional(), required: z.boolean().optional(), }); export type UpdateProjectFieldArgs = z.infer<typeof updateProjectFieldSchema>;
- src/infrastructure/tools/ToolRegistry.ts:244-244 (registration)Registers the updateProjectFieldTool in the central tool registry during initialization.this.registerTool(updateProjectFieldTool);
- ToolDefinition object that includes name, description, schema reference, and usage examples for the tool.export const updateProjectFieldTool: ToolDefinition<UpdateProjectFieldArgs> = { name: "update_project_field", description: "Update a custom field in a GitHub project", schema: updateProjectFieldSchema as unknown as ToolSchema<UpdateProjectFieldArgs>, examples: [ { name: "Update field options", description: "Update options for a single-select field", args: { projectId: "PVT_kwDOLhQ7gc4AOEbH", fieldId: "PVTF_lADOLhQ7gc4AOEbHzM4AOAI1", name: "Updated Status", options: [ { name: "Not Started", color: "red" }, { name: "In Progress", color: "yellow" }, { name: "Review", color: "blue" }, { name: "Complete", color: "green" } ] } } ] };
- src/infrastructure/tools/ToolRegistry.ts:52-52 (registration)Import of the updateProjectFieldTool from ToolSchemas.ts for registration.updateProjectFieldTool,