Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

feat: add a framework for translations#25

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
SamMorrowDrums merged 1 commit intomainfromoverride-text-i18n
Mar 20, 2025

Conversation

SamMorrowDrums
Copy link
Collaborator

@SamMorrowDrumsSamMorrowDrums commentedMar 19, 2025
edited
Loading

Closes#24

i18n / Overriding descriptions

The descriptions of the tools can be overridden by creating a github-mcp-server.json file in the same directory as the binary.
The file should contain a JSON object with the tool names as keys and the new descriptions as values.
For example:

{"TOOL_ADD_ISSUE_COMMENT_DESCRIPTION":"an alternative description","TOOL_CREATE_BRANCH_DESCRIPTION":"Create a new branch in a GitHub repository"}

You can create an export of the current translations by running the binary with the--export-translations flag.
This flag will preserve any translations/overrides you have made, while adding any new translations that have been added to the binary since the last time you exported.

./github-mcp-server --export-translationscat github-mcp-server.json

You can also use ENV vars to override the descriptions. The environment variable names are the same as the keys in the JSON file,
prefixed withGITHUB_MCP_ and all uppercase.
For example, to override theTOOL_ADD_ISSUE_COMMENT_DESCRIPTION tool, you can set the following environment variable:

export GITHUB_MCP_TOOL_ADD_ISSUE_COMMENT_DESCRIPTION="an alternative description"

The JSON Dump

So far, I have drawn the line at descriptions, but parameters can easily be added, I just didn't want this PR to touch any more parts. This is the whole shebang:

{"RESOURCE_REPOSITORY_CONTENT_BRANCH_DESCRIPTION":"Repository Content for specific branch","RESOURCE_REPOSITORY_CONTENT_COMMIT_DESCRIPTION":"Repository Content for specific commit","RESOURCE_REPOSITORY_CONTENT_DESCRIPTION":"Repository Content","RESOURCE_REPOSITORY_CONTENT_PR_DESCRIPTION":"Repository Content for specific pull request","RESOURCE_REPOSITORY_CONTENT_TAG_DESCRIPTION":"Repository Content for specific tag","TOOL_ADD_ISSUE_COMMENT_DESCRIPTION":"Add a comment to an existing issue","TOOL_CREATE_BRANCH_DESCRIPTION":"Create a new branch in a GitHub repository","TOOL_CREATE_OR_UPDATE_FILE_DESCRIPTION":"Create or update a single file in a GitHub repository","TOOL_CREATE_REPOSITORY_DESCRIPTION":"Create a new GitHub repository in your account","TOOL_FORK_REPOSITORY_DESCRIPTION":"Fork a GitHub repository to your account or specified organization","TOOL_GET_CODE_SCANNING_ALERT_DESCRIPTION":"Get details of a specific code scanning alert in a GitHub repository.","TOOL_GET_FILE_CONTENTS_DESCRIPTION":"Get the contents of a file or directory from a GitHub repository","TOOL_GET_ISSUE_DESCRIPTION":"Get details of a specific issue in a GitHub repository.","TOOL_GET_ME_DESCRIPTION":"Get details of the authenticated GitHub user","TOOL_GET_PULL_REQUEST_COMMENTS_DESCRIPTION":"Get the review comments on a pull request","TOOL_GET_PULL_REQUEST_DESCRIPTION":"Get details of a specific pull request","TOOL_GET_PULL_REQUEST_FILES_DESCRIPTION":"Get the list of files changed in a pull request","TOOL_GET_PULL_REQUEST_REVIEWS_DESCRIPTION":"Get the reviews on a pull request","TOOL_GET_PULL_REQUEST_STATUS_DESCRIPTION":"Get the combined status of all status checks for a pull request","TOOL_LIST_CODE_SCANNING_ALERTS_DESCRIPTION":"List code scanning alerts in a GitHub repository.","TOOL_LIST_COMMITS_DESCRIPTION":"Get list of commits of a branch in a GitHub repository","TOOL_LIST_PULL_REQUESTS_DESCRIPTION":"List and filter repository pull requests","TOOL_MERGE_PULL_REQUEST_DESCRIPTION":"Merge a pull request","TOOL_SEARCH_CODE_DESCRIPTION":"Search for code across GitHub repositories","TOOL_SEARCH_ISSUES_DESCRIPTION":"Search for issues and pull requests across GitHub repositories","TOOL_SEARCH_REPOSITORIES_DESCRIPTION":"Search for GitHub repositories","TOOL_SEARCH_USERS_DESCRIPTION":"Search for GitHub users","TOOL_UPDATE_PULL_REQUEST_BRANCH_DESCRIPTION":"Update a pull request branch with the latest changes from the base branch"}

Live exampletools/list

An example running with a file, and an env var:

{"jsonrpc":"2.0","id":3,"result": {"tools": [      {"description":"an alternative description","inputSchema": {"type":"object","properties": {"body": {"description":"Comment text","type":"string"            },"issue_number": {"description":"Issue number to comment on","type":"number"            },"owner": {"description":"Repository owner","type":"string"            },"repo": {"description":"Repository name","type":"string"            }          },"required": ["owner","repo","issue_number","body"          ]        },"name":"add_issue_comment"      },      {"description":"OVERRIDE DESCRIPTION","inputSchema": {"type":"object","properties": {"branch": {"description":"Name for new branch","type":"string"            },"from_branch": {"description":"Source branch (defaults to repo default)","type":"string"            },"owner": {"description":"Repository owner","type":"string"            },"repo": {"description":"Repository name","type":"string"            }          },"required": ["owner","repo","branch"          ]        },"name":"create_branch"      },...    ]  }}

Copy link
Contributor

@CopilotCopilotAI 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 implements a new translation framework that enables overriding tool and resource descriptions through environment variables and JSON configuration. The key changes include updating all GitHub tool and resource functions to accept a translation function parameter, modifying tests to pass a default translation function, and adding preliminary translation support in the server initialization.

Reviewed Changes

Copilot reviewed 14 out of 14 changed files in this pull request and generated 1 comment.

Show a summary per file
FileDescription
pkg/github/server.goUpdated NewServer to retrieve and pass the translation helper.
pkg/github/repositories.goUpdated tool functions to accept the translation function.
pkg/github/search.goUpdated search tool functions to use the translation function.
pkg/github/issues.goUpdated issue tool functions to use the translation function.
pkg/github/pullrequests.goUpdated pull request tool functions to accept the translation function.
pkg/github/code_scanning.goUpdated code scanning tool functions to use the translation function.
Various test filesModified test cases to pass the default translation function.

Tip: Leave feedback on Copilot's review comments with the 👎 and 👍 buttons to help improve review quality.Learn more

@SamMorrowDrumsSamMorrowDrums changed the titleAdd a framework for translationsfeat: add a framework for translationsMar 20, 2025
@SamMorrowDrumsSamMorrowDrums merged commitdd46f8a intomainMar 20, 2025
4 checks passed
@SamMorrowDrumsSamMorrowDrums deleted the override-text-i18n branchMarch 20, 2025 17:33
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

Copilot code reviewCopilotCopilot left review comments

@juruenjuruenjuruen approved these changes

@tobytobyAwaiting requested review from toby

Assignees
No one assigned
Labels
None yet
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

User-defined tool descriptions
2 participants
@SamMorrowDrums@juruen

[8]ページ先頭

©2009-2025 Movatter.jp