MCP Tools Reference: developerconnect.googleapis.com

工具:fetch-repo-file-blame

提取 Git 代码库中特定文件的 blame 信息。

以下代码示例展示了如何使用 curl 调用 fetch-repo-file-blame 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": "fetch-repo-file-blame",
    "arguments": {
      // Provide these details according to the MCP tool specification.
    }
  },
  "jsonrpc": "2.0",
  "id": 1
}'

输入架构

FetchGitRepositoryLinkFileBlame 的请求消息。

FetchGitRepositoryLinkFileBlameRequest

JSON 表示法
{
  "name": string,
  "ref": string,
  "path": string,
  "firstLine": integer,
  "lastLine": integer
}
字段
name

string

必需。GitRepositoryLink 的资源名称,格式为 projects/*/locations/*/connections/*/gitRepositoryLinks/*。

ref

string

必需。SCM 提交 SHA 或符号修订版本(例如分支名称、标记),用于提取 blame。

path

string

必需。代码库中的文件路径。

firstLine

integer

可选。要追溯的范围的起始行号(从 1 开始,含边界值)。如果未指定,则从第 1 行开始追溯。

lastLine

integer

可选。要追责的范围的结束行号(从 1 开始,包含该行)。如果未指定,则追溯范围会延伸到文件末尾。

输出架构

FetchGitRepositoryLinkFileBlame 的响应消息。

FetchGitRepositoryLinkFileBlameResponse

JSON 表示法
{
  "ranges": [
    {
      object (BlameRange)
    }
  ]
}
字段
ranges[]

object (BlameRange)

文件的 blame 范围列表。

BlameRange

JSON 表示法
{
  "firstLine": integer,
  "lastLine": integer,
  "commit": {
    object (SCMCommit)
  }
}
字段
firstLine

integer

范围的起始行号(从 1 开始,含边界值)。

lastLine

integer

范围的结束行号(从 1 开始,包含该行)。

commit

object (SCMCommit)

此行范围的提交元数据。

SCMCommit

JSON 表示法
{
  "sha": string,
  "message": string,
  "author": string,
  "authorEmail": string,
  "commitTime": string,
  "url": string
}
字段
sha

string

完整的 40 字符 SCM 提交 SHA。

message

string

提交消息文本。

author

string

作者的显示名称。

authorEmail

string

作者的邮箱。

commitTime

string (Timestamp format)

提交创建时的时间戳。

采用 RFC 3339 标准,生成的输出将始终进行 Z 规范化(即转换为 UTC 零时区格式并在末尾附加 Z),并使用 0、3、6 或 9 个小数位。不带“Z”的偏差时间也是可以接受的。示例:"2014-10-02T15:01:23Z"、"2014-10-02T15:01:23.045123456Z" 或 "2014-10-02T15:01:23+05:30"。

url

string

此提交的 SCM 提供商 HTML 网址链接。

时间戳

JSON 表示法
{
  "seconds": string,
  "nanos": integer
}
字段
seconds

string (int64 format)

表示世界协调时间 (UTC) 的秒数(从 Unix 纪元 1970-01-01T00:00:00Z 开始算起)。必须介于 -62135596800 到 253402300799 之间(含边界值,对应于 0001-01-01T00:00:00Z 到 9999-12-31T23:59:59Z)。

nanos

integer

秒数的非负小数部分(以纳秒为单位)。此字段是时长的纳秒部分,而不是秒的替代。对于含小数部分的负秒数,仍必须包含按时间递升的非负纳秒值。必须在 0 到 999,999,999 之间(含边界值)。

工具注释

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

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

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

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