工具:get_documents
使用此工具,您可以在 names 参数中传递文档资源名称列表(例如 get_documents(names=["documents/..."]);参数为 names,接受字符串列表,而不是 name),从而在单次调用中检索单个文档或最多 20 个文档的完整 Markdown 内容。请始终先从 search_documents 结果的 parent 字段或 answer_query 结果的 references 字段获取确切的 documents/{uri_without_scheme} 资源名称;切勿凭记忆或外部网址猜测或构建 documents/... 路径。在最终回答中引用所使用的权威来源文档资源名称 (documents/...)。
以下代码示例展示了如何使用 curl 调用 get_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": "get_documents", "arguments": { // Provide these details according to the MCP tool specification. } }, "jsonrpc": "2.0", "id": 1 }' |
输入架构
get_documents 的请求架构。
GetDocumentsRequest
| JSON 表示法 |
|---|
{ "names": [ string ] } |
| 字段 | |
|---|---|
names[] |
必需。要在单次调用中检索的 1 到 20 个文档资源名称 ( |
输出架构
get_documents 的响应 schema。
GetDocumentsResponse
| JSON 表示法 |
|---|
{
"documents": [
{
object ( |
| 字段 | |
|---|---|
documents[] |
已请求文件。 |
文档
| JSON 表示法 |
|---|
{ "name": string, "uri": string, "content": string, "description": string, "title": string } |
| 字段 | |
|---|---|
name |
标识符。文档的资源名称。格式: |
uri |
仅限输出。内容的 URI,例如 |
content |
仅限输出。文档的内容(采用 Markdown 格式)。 |
description |
仅限输出。文档的说明。 |
title |
仅限输出。文档标题。 |
工具注释
工具注解会发送到 MCP 客户端,用于描述给定工具的基本风险。大多数客户端会将这些提示视为不可信,但它们可用于决定何时向用户发送确认提示。
除了标题字符串之外,还定义了以下布尔值提示:
readOnlyHint:如果为 true,则该工具不会修改其环境。默认值:false。destructiveHint:如果为 true,则该工具可以执行破坏性操作。如果为 false,则该工具只能执行添加操作。默认值:true。idempotentHint:如果为 true,则使用相同参数重复调用该工具不会对其环境产生额外影响。默认值:false。openWorldHint:如果为 true,则该工具可以与外部实体的“开放世界”进行交互。如果为 false,则该工具只能与内部实体交互。例如,网页搜索工具是开放式的,而记忆工具不是开放式的。
破坏性提示:❌ | 等幂性提示:✅ | 只读提示:✅ | 开放世界提示:❌