Skip to content

Conversation

tonytrg
Copy link
Contributor

@tonytrg tonytrg commented Oct 8, 2025

This PR adds label management tools using a consolidated approach with GraphQL-only operations.

Resolves #312

Summary

Following the tool consolidation pattern from #1172, this PR introduces three multi-functional label management tools:

  • get_label - Retrieves a specific label by name from a repository
  • list_label - Lists labels from a repository OR an issue (uses issue_number parameter to switch context)
  • write_label - Unified write operations with method parameter:
    • create - Create a new label (requires name, color)
    • update - Update existing label (requires name, at least one of new_name/color/description)
    • delete - Delete a label (requires name)

Design Philosophy

We're moving toward consolidated, multi-functional tools that use method parameters to handle related operations, rather than creating separate tools for each action. This approach:

Technical Details

All operations use GraphQL exclusively (gqlClient) for consistency and efficiency:

  • Queries use repository.labels and repository.issue.labels
  • Mutations use createLabel, updateLabel, and deleteLabel
  • Helper functions getRepositoryID() and getLabelID() support the mutations

@tonytrg tonytrg requested a review from a team as a code owner October 8, 2025 14:57
@Copilot Copilot AI review requested due to automatic review settings October 8, 2025 14:57
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR adds comprehensive GitHub Labels tools functionality to the GitHub MCP Server, enabling users to create, read, update, and delete repository labels through dedicated tools.

  • Introduces a new "labels" toolset with three core functions: get_label, list_label, and write_label
  • Adds extensive test coverage for all label operations including edge cases and error scenarios
  • Updates documentation to include the new labels toolset in both README and remote server documentation

Reviewed Changes

Copilot reviewed 8 out of 8 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
pkg/github/tools.go Adds ToolsetLabels metadata and integrates label tools into the default toolset group
pkg/github/labels.go Implements the three main label tools with GraphQL operations for CRUD functionality
pkg/github/labels_test.go Comprehensive test suite covering all label operations and error cases
pkg/github/toolsnaps/*.snap Tool schema snapshots for the three label tools
docs/remote-server.md Documents the new labels toolset in the remote server table
README.md Updates tool documentation with labels section and individual tool descriptions

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@tonytrg tonytrg force-pushed the tonytrg/adding-labels branch from a3c3352 to e45da8d Compare October 9, 2025 06:57
@tonytrg tonytrg merged commit bbfc44c into main Oct 9, 2025
16 checks passed
@tonytrg tonytrg deleted the tonytrg/adding-labels branch October 9, 2025 09:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add complete label management functionality to GitHub MCP server
2 participants