MCP Tools Reference: developerknowledge.googleapis.com

工具:search_documents

您可以使用此工具查找有关 Google 开发者产品的文档。这些文档包含官方 API、代码段、版本说明、最佳实践、指南、调试信息等。涵盖以下产品和网域:

  • ADK:adk.dev

  • Android:developer.android.com

  • Apigee:docs.apigee.com

  • Chrome:developer.chrome.com

  • Dart:dart.dev

  • Firebase:firebase.google.com

  • Flutter:docs.flutter.dev

  • Fuchsia:fuchsia.dev

  • Gemini CLI:geminicli.com

  • Go:go.dev

  • Google AI:ai.google.dev

  • Google Antigravity:antigravity.google

  • Google Cloud:cloud.google.com 和 docs.cloud.google.com

  • Google Developers、Google Ads、Google 搜索、Google 地图、YouTube:developers.google.com

  • Google Home:developers.home.google.com

  • Google Maps Platform:mapsplatform.google.com

  • TensorFlow:www.tensorflow.org

  • Web:web.dev

此工具会返回匹配文档的文本块、名称和网址。如果返回的块不够详细,无法回答用户的问题,请使用此工具输出中的 parent 调用 get_documents,以检索完整文档内容。

以下代码示例展示了如何使用 curl 调用 search_documents MCP 工具。

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

输入架构

search_documents 的请求架构。使用 query 字段搜索相关的 Google 开发者文档。

SearchDocumentChunksRequest

JSON 表示法
{
  "query": string
}
字段
query

string

必需。用户提供的原始查询字符串,例如“如何创建 Cloud Storage 存储分区?”。

输出架构

search_documents 的响应架构。

SearchDocumentChunksResponse

JSON 表示法
{
  "results": [
    {
      object (DocumentChunk)
    }
  ]
}
字段
results[]

object (DocumentChunk)

给定查询的搜索结果。此列表中的每个文档都包含与搜索查询相关的内容片段。使用每个结果的 DocumentChunk.name 字段和 get_documents 检索完整文档内容。

DocumentChunk

JSON 表示法
{
  "parent": string,
  "id": string,
  "content": string
}
字段
parent

string

仅限输出。此块所属文档的资源名称。格式:documents/{uri_without_scheme} 示例:documents/docs.cloud.google.com/storage/docs/creating-buckets

id

string

仅限输出。此块在文档中的 ID。块 ID 在文档中是唯一的,但在文档之间不是全局唯一的。块 ID 不稳定,可能会随时间变化。

content

string

仅限输出。文档块的内容。

工具注释

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

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

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

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