ESC
AI 6 分钟阅读

ChatGPT Work工具与技能参考:GitHub集成MCP工具声明详解

该文档为ChatGPT Work模式的工具与技能参考,展示了用于访问GitHub仓库、Issue及Pull Request的MCP工具的TypeScript声明,包括为Issue评论添加反应(reaction)等功能的接口定义与参数说明。此类工具是Codex等功能的基础组件,揭示了OpenAI如何让ChatGPT直接操作GitHub工作流。

来源:Hacker News

`访问仓库、issue 和 pull request。某些功能(例如 Codex)需要此权限

为 issue 评论添加表情回应。该工具属于插件 Data Analytics 与 GitHub。

exec 工具声明:

declare const tools: { mcp__codex_apps__github_add_reaction_to_issue_comment(args: {
 // Numeric issue or review comment ID.
 comment_id: number;
 // Reaction identifier such as `+1` or `eyes`.
 reaction: string;
 // Repository in `owner/name` form, such as `openai/openai`. This maps to GitHub REST `owner` and `repo` path parameters: https://docs.github.com/en/rest/repos/repos#get-a-repository
 repo_full_name: string;
}): Promise<CallToolResult<{ result: { content: string; created_at: string; id: number; node_id: string; user: { avatar_url?: string | null; email?: string | null; id?: number | null; login: string; name?: string | null; }; }; }>>; };

mcp__codex_apps__github_add_reaction_to_pr

已连接应用 访问仓库、issue 和 pull request。某些功能(例如 Codex)需要此权限

`访问仓库、issue 和 pull request。某些功能(例如 Codex)需要此权限

为 GitHub pull request 添加表情回应。该工具属于插件 Data Analytics 与 GitHub。

exec 工具声明:

declare const tools: { mcp__codex_apps__github_add_reaction_to_pr(args: {
 // Pull request number in the repository.
 pr_number: number;
 // Reaction identifier such as `+1` or `eyes`.
 reaction: string;
 // Repository in `owner/name` form, such as `openai/openai`. This maps to GitHub REST `owner` and `repo` path parameters: https://docs.github.com/en/rest/repos/repos#get-a-repository
 repo_full_name: string;
}): Promise<CallToolResult<{ result: { content: string; created_at: string; id: number; node_id: string; user: { avatar_url?: string | null; email?: string | null; id?: number | null; login: string; name?: string | null; }; }; }>>; };

mcp__codex_apps__github_add_reaction_to_pr_review_comment

已连接应用 访问仓库、issue 和 pull request。某些功能(例如 Codex)需要此权限

`访问仓库、issue 和 pull request。某些功能(例如 Codex)需要此权限

为 pull request 审查评论添加表情回应。该工具属于插件 Data Analytics 与 GitHub。

exec 工具声明:

declare const tools: { mcp__codex_apps__github_add_reaction_to_pr_review_comment(args: {
 // Numeric issue or review comment ID.
 comment_id: number;
 // Reaction identifier such as `+1` or `eyes`.
 reaction: string;
 // Repository in `owner/name` form, such as `openai/openai`. This maps to GitHub REST `owner` and `repo` path parameters: https://docs.github.com/en/rest/repos/repos#get-a-repository
 repo_full_name: string;
}): Promise<CallToolResult<{ result: { content: string; created_at: string; id: number; node_id: string; user: { avatar_url?: string | null; email?: string | null; id?: number | null; login: string; name?: string | null; }; }; }>>; };

mcp__codex_apps__github_add_review_to_pr

已连接应用 访问仓库、issue 和 pull request。某些功能(例如 Codex)需要此权限

`访问仓库、issue 和 pull request。某些功能(例如 Codex)需要此权限

为 GitHub pull request 添加审查。当事件为 REQUEST_CHANGES 或 COMMENT 时,review 为必填项。该工具属于插件 Data Analytics 与 GitHub。

exec 工具声明:

declare const tools: { mcp__codex_apps__github_add_review_to_pr(args: {
 // Review action to take. `review` is required for `COMMENT` and `REQUEST_CHANGES`.
 action: "COMMENT" | "APPROVE" | "REQUEST_CHANGES";
 // Optional commit SHA to anchor the review.
 commit_id?: string | null;
 // Optional inline file comments to include with the review.
 file_comments?: Array<{
 // Body text for the review comment.
 body: string;
 // File line number for line-based review comments.
 line?: number | null;
 // Repository path of the file to comment on.
 path: string;
 // The position in the diff where you want to add a review comment. Note this value is not the same as the line number in the file. The position value equals the number of lines down from the first "@@" hunk header in the file you want to add a comment. The line just below the "@@" line is position 1, the next line is position 2, and so on. The position in the diff continues to increase through lines of whitespace and additional hunks until the beginning of a new file.
 position?: number | null;
 // Diff side for `line`, such as `LEFT` or `RIGHT`.
 side?: string | null;
 // Starting line number for a multi-line review comment range.
 start_line?: number | null;
 // Diff side for `start_line`, such as `LEFT` or `RIGHT`.
 start_side?: string | null;
}> | null;
 // Pull request number in the repository.
 pr_number: number;
 // Repository in `owner/name` form, such as `openai/openai`. This maps to GitHub REST `owner` and `repo` path parameters: https://docs.github.com/en/rest/repos/repos#get-a-repository
 repo_full_name: string;
 // Review body to submit. Required when requesting changes or leaving a comment.
 review?: string | null;
}): Promise<CallToolResult<{ result: {
 // Identifier of the created or  review_id?: string | number | null;
 // Whether the review operation completed successfully.
 success: boolean;
}; }>>; };

mcp__codex_apps__github_compare_commits

已连接应用 访问仓库、issue 和 pull request。某些功能(例如 Codex)需要此权限

`访问仓库、issue 和 pull request。某些功能(例如 Codex)需要此权限

比较两个提交/ref,返回按文件统计的信息以及比较元数据。这是围绕 GithubPlugin.compare_commits 的轻量封装,旨在为连接器使用者提供稳定、紧凑的响应结构。该工具属于插件 Data Analytics 与 GitHub。

exec 工具声明:

declare const tools: { mcp__codex_apps__github_compare_commits(args: { base: string; head: string; repo_full_name: string; }): Promise<CallToolResult<{ result: { ahead_by?: number | null; base: string; base_commit?: { html_url?: string | null; sha: string; url?: string | null; } | null; behind_by?: number | null; files?: Array<{ additions?: number | null; changes?: number | null; deletions?: number | null; filename: string; previous_filename?: string | null; status?: string | null; }>; head: string; merge_base_commit?: { html_url?: string | null; sha: string; url?: string | null; } | null; repository_full_name: string; status?: string | null; too_large?: boolean | null; total_commits?: number | null; }; }>>; };

mcp__codex_apps__github_convert_pull_request_to_draft

已连接应用 访问仓库、issue 和 pull request。某些功能(例如 Codex)需要此权限

`访问仓库、issue 和 pull request。某些功能(例如 Codex)需要此权限

将开启中的 pull request 转换回草稿状态。转换完成后返回连接器规范化后的 PR 快照。文档:https://docs.github.com/en/graphql/reference/mutations#convertpullrequesttodraft。该工具属于插件 Data Analytics 与 GitHub。

exec 工具声明:

declare const tools: { mcp__codex_apps__github_convert_pull_request_to_draft(args: {
 // Pull request number in the repository.
 pr_number: number;
 // Repository in `owner/name` form, such as `openai/openai`. This maps to GitHub REST `owner` and `repo` path parameters: https://docs.github.com/en/rest/repos/repos#get-a-repository
 repository_full_name: string;
}): Promise<CallToolResult<{ result: { [key: string]: unknown; }; }>>; };

mcp__codex_apps__github_create_blob

已连接应用 访问仓库、issue 和 pull request。某些功能(例如 Codex)需要此权限

`访问仓库、issue 和 pull request。某些功能(例如 Codex)需要此权限

在仓库中创建一个 blob 并返回其 SHA。该工具属于插件 Data Analytics 与 GitHub。

exec 工具声明:

declare const tools: { mcp__codex_apps__github_create_blob(args: {
 // Blob content to store in the repository.
 content: string;
 // One of utf-8 or base64. Default is utf-8.
 encoding?: "utf-8" | "base64";
 // Repository in `owner/name` form, such as `openai/openai`. This maps to GitHub REST `owner` and `repo` path parameters: https://docs.github.com/en/rest/repos/repos#get-a-repository
 repository_full_name: string;
}): Promise<CallToolResult<{ result: { [key: string]: unknown; }; }>>; };

mcp__codex_apps__github_create_branch

已连接应用 访问仓库、issue 和 pull request。某些功能(例如 Codex)需要此权限

`访问仓库、issue 和 pull request。某些功能(例如 Codex)需要此权限

基于恰好一个现有的提交 SHA 或基础 ref 创建新分支。该工具属于插件 Data Analytics 与 GitHub。

exec 工具声明:

declare const tools: { mcp__codex_apps__github_create_branch(args: {
 // Existing branch, tag, or commit ref to use as the new branch's starting point. Provide exactly one of `base_ref` or `sha`.
 base_ref?: string | null;
 // Branch name to create or update.
 branch_name: string;
 // Repository in `owner/name` form, such as `openai/openai`. This maps to GitHub REST `owner` and `repo` path parameters: https://docs.github.com/en/rest/repos/repos#get-a-repository
 repository_full_name: string;
 // Existing commit SHA to use as the new branch's starting point. Provide exactly one of `sha` or `base_ref`.
 sha?: string | null;
}): Promise<CallToolResult<{ result: { [key: string]: unknown; }; }>>; };

mcp__codex_apps__github_create_commit

已连接应用 访问仓库、issue 和 pull request。某些功能(例如 Codex)需要此权限

`访问仓库、issue 和 pull request。某些功能(例如 Codex)需要此权限

创建一个指向 tree_sha 的提交,该提交具有一个或多个父提交。该工具属于插件 Data Analytics 与 GitHub。

exec 工具声明:

declare const tools: { mcp__codex_apps__github_create_commit(args: {
 // Additional ordered commit parent SHAs. Defaults to no additional parents.
 additional_parent_shas?: Array<string> | null;
 // Commit message to use for the new commit.
 message: string;
 // Parent commit SHA for the new commit.
 parent_sha: string;
 // Repository in `owner/name` form, such as `openai/openai`. This maps to GitHub REST `owner` and `repo` path parameters: https://docs.github.com/en/rest/repos/repos#get-a-repository
 repository_full_name: string;
 // Tree SHA to point the new commit at.
 tree_sha: string;
}): Promise<CallToolResult<{ result: { [key: string]: unknown; }; }>>; };

mcp__codex_apps__github_create_file

已连接应用 访问仓库、issue 和 pull request。某些功能(例如 Codex)需要此权限

`访问仓库、issue 和 pull request。某些功能(例如 Codex)需要此权限

通过 GitHub 的 contents API 创建一个新的 UTF-8 文本文件。仅返回最终生成的提交 SHA,而非 GitHub 完整的 content/commit 载荷。文档:https://docs.github.com/en/rest/repos/contents?apiVersion=2022-11-28#create-or-update-file-contents。该工具属于插件 Data Analytics 与 GitHub。

exec 工具声明:

declare const tools: { mcp__codex_apps__github_create_file(args: {
 // Optional existing branch to create the file on. Leave null to use the default branch. This action never creates a branch; use create_branch first when needed.
 branch?: string | null;
 // Complete UTF-8 text contents to write. This wrapper base64-encodes the text for GitHub's contents API.
 content: string;
 // Commit message for the new file.
 message: string;
 // New file path within the repository. The path must not already exist on the target branch. To replace an existing file, call fetch_file first and pass its current blob SHA to update_file.
 path: string;
 // Repository in `owner/name` form, such as `openai/openai`. This maps to GitHub REST `owner` and `repo` path parameters: https://docs.github.com/en/rest/repos/repos#get-a-repository
 repository_ful