MCP Tools Reference: developerconnect.googleapis.com

工具:diff-repo-commit

获取 Git 代码库中两个提交之间的差异。如需检索逐行补丁块,请传递 path_filters(例如,['**'] 表示所有文件)。

以下代码示例展示了如何使用 curl 调用 diff-repo-commit MCP 工具。

Curl 请求
curl --location 'https://developerconnect.googleapis.com/mcp' \
--header 'content-type: application/json' \
--header 'accept: application/json, text/event-stream' \
--data '{
  "method": "tools/call",
  "params": {
    "name": "diff-repo-commit",
    "arguments": {
      // Provide these details according to the MCP tool specification.
    }
  },
  "jsonrpc": "2.0",
  "id": 1
}'

输入架构

DiffGitRepositoryLinkCommit 的请求消息。

DiffGitRepositoryLinkCommitRequest

JSON 表示法
{
  "name": string,
  "baseSha": string,
  "headSha": string,
  "pathFilters": [
    string
  ]
}
字段
name

string

必需。GitRepositoryLink 的资源名称。

baseSha

string

必需。基础提交 SHA 或引用。

headSha

string

必需。头提交 SHA 或引用。

pathFilters[]

string

可选。用于过滤返回文件的路径模式或确切路径。指定 path_filters 后,系统会为所有匹配的文件填充 FileDiff.patch(使用 ["**"] 可包含所有已更改文件的补丁)。如果省略 path_filters 或其为空,则系统会返回 FileDiff 的完整列表,而不包含补丁差异(FileDiff.patch 为空)。

输出架构

DiffGitRepositoryLinkCommit 的响应消息。

DiffGitRepositoryLinkCommitResponse

JSON 表示法
{
  "files": [
    {
      object (FileDiff)
    }
  ]
}
字段
files[]

object (FileDiff)

从统一差异中提取的文件差异。

FileDiff

JSON 表示法
{
  "path": string,
  "status": string,
  "patch": string
}
字段
path

string

代码库中文件的相对路径。

status

string

更改的状态:“ADDED”“MODIFIED”“REMOVED”“RENAMED”。

patch

string

文件的标准统一差异补丁块。仅在请求中指定 path_filters 时填充;否则为空。

工具注释

工具注解会发送到 MCP 客户端,用于描述给定工具的基本风险。大多数客户端会将这些提示视为不可信,但可用于决定何时向用户发送确认提示。

除了标题字符串之外,还定义了以下布尔值提示:

  • readOnlyHint:如果为 true,则该工具不会修改其环境。默认值:false。
  • destructiveHint:如果为 true,则该工具可以执行破坏性操作。如果为 false,则该工具只能执行添加操作。默认值:true。
  • idempotentHint:如果为 true,则使用相同参数重复调用该工具不会对其环境产生额外影响。默认值:false。
  • openWorldHint:如果为 true,则该工具可以与外部实体的“开放世界”进行交互。如果为 false,则该工具只能与内部实体交互。例如,网页搜索工具是开放世界,而记忆工具不是开放世界。

破坏性提示:❌ | 等幂性提示:✅ | 只读提示:✅ | 开放世界提示:❌