工具:answer_query
使用 answer_query 获取有关 Google 开发者产品的接地回答。此工具的配额有限。此工具会综合语料库中的信息,生成对查询的回答。answer_query 使用与 search_documents 相同的语料库来提供回答。此工具会返回生成的 answer_text 以及用于生成回答的文档名称(参考)列表。如果需要,可以使用 get_documents 和文档名称来提取整个文档内容。
如果您收到 429 配额不足错误,请改用 search_documents。
以下示例演示了如何使用 curl 调用 answer_query 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": "answer_query", "arguments": { // provide these details according to the tool's MCP specification } }, "jsonrpc": "2.0", "id": 1 }' |
输入架构
AnswerQuery 的请求消息。
AnswerQueryRequest
| JSON 表示法 |
|---|
{ "query": string } |
| 字段 | |
|---|---|
query |
必需。要回答的查询。 |
输出架构
AnswerQuery 的响应消息。
AnswerQueryResponse
| JSON 表示法 |
|---|
{ "answerText": string, "references": [ string ] } |
| 字段 | |
|---|---|
answerText |
查询的答案。 |
references[] |
仅限输出。用于生成回答的文档的资源名称。 |
工具注释
破坏性提示:❌ | 等幂性提示:✅ | 只读提示:✅ | 开放世界提示:❌