retrieving-developer-knowledge

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Google Developer Knowledge

谷歌开发者知识库

The Developer Knowledge skill provides access to official Google developer documentation across Google Cloud, AI/ML (ai.google.dev, ADK, TensorFlow), Android, Chrome, Web, Flutter, Go, Firebase, and other Google developer platforms via the Developer Knowledge MCP server or REST API fallback.
Developer Knowledge技能可通过Developer Knowledge MCP服务器或REST API备选方案,访问Google Cloud、AI/ML(ai.google.dev、ADK、TensorFlow)、Android、Chrome、Web、Flutter、Go、Firebase及其他谷歌开发者平台的官方谷歌开发者文档。

Workflow

工作流

  1. Direct Retrieval: When answering a technical question, execute a single documentation lookup directly within your current conversation context (do not delegate retrieval to subagents):
    • If MCP tools are present in your environment: Call
      answer_query
      (for conceptual guides/workflows) or
      search_documents
      (for CLI flags/syntax).
    • If MCP tools are not present: Execute a REST API request via
      curl
      against
      https://developerknowledge.googleapis.com/v1
      .
  2. Immediate & Complete Solution Output: Immediately upon receiving the documentation response, output the complete, self-contained, and executable technical solution (commands with all required flags and placeholders, YAML/JSON configurations, or code snippets) directly in your response text.
  1. 直接检索:在回答技术问题时,直接在当前对话语境中执行单次文档查询(无需将检索任务委托给子Agent):
    • 若环境中存在MCP工具:调用
      answer_query
      (用于概念指南/工作流)或
      search_documents
      (用于CLI标志/语法)。
    • 若环境中不存在MCP工具:通过
      curl
      https://developerknowledge.googleapis.com/v1
      发送REST API请求。
  2. 即时输出完整解决方案:收到文档响应后,立即在回复文本中输出完整、独立且可执行的技术解决方案(包含所有必要标志和占位符的命令、YAML/JSON配置或代码片段)。

Tool Selection & Usage

工具选择与使用

Choose the appropriate tool based on availability in your runtime environment:
根据运行时环境中的工具可用性选择合适的工具:

1. Developer Knowledge MCP Tools (Preferred)

1. Developer Knowledge MCP工具(首选)

When MCP tools are present in your active tool definitions:
  • answer_query(query="...")
    : Use for conceptual guides, architectural comparisons, product choice overviews, and multi-step workflows.
  • search_documents(query="...", page_size=5)
    : Use for granular CLI flags, exact syntax, parameter names, and IAM permissions (
    service.resource.verb
    ). Use 2–5 focused keywords (e.g.,
    cloud run filestore nfs mount gcloud
    ) rather than full conversational sentences.
  • get_documents(names=["documents/{uri_without_scheme}"])
    : Fetch full documentation pages by resource name (e.g.
    names: ["documents/docs.cloud.google.com/run/docs/overview/what-is-cloud-run"]
    ).
当活跃工具定义中存在MCP工具时:
  • answer_query(query="...")
    :用于概念指南、架构对比、产品选型概述及多步骤工作流。
  • search_documents(query="...", page_size=5)
    :用于细粒度CLI标志、精确语法、参数名称及IAM权限(
    service.resource.verb
    )。使用2–5个聚焦关键词(例如
    cloud run filestore nfs mount gcloud
    ),而非完整的对话式语句。
  • get_documents(names=["documents/{uri_without_scheme}"])
    :通过资源名称获取完整文档页面(例如
    names: ["documents/docs.cloud.google.com/run/docs/overview/what-is-cloud-run"]
    )。

2. REST API Fallback

2. REST API备选方案

When MCP tools are not declared in your environment, use HTTP requests (
curl
) against the Developer Knowledge REST API (
https://developerknowledge.googleapis.com/v1
) with the environment API key (
DEVELOPERKNOWLEDGE_API_KEY
):
  • Answer Query:
    bash
    curl -s -X POST "https://developerknowledge.googleapis.com/v1:answerQuery?key=${DEVELOPERKNOWLEDGE_API_KEY}" \
      -H "Content-Type: application/json" \
      -d '{"query": "How do I configure public read access on Cloud Storage?"}'
  • Search Document Chunks (use 2–5 focused keywords):
    bash
    curl -s "https://developerknowledge.googleapis.com/v1/documents:searchDocumentChunks?query=gcloud+logging+metrics+create&key=${DEVELOPERKNOWLEDGE_API_KEY}"
  • Get Document:
    bash
    curl -s "https://developerknowledge.googleapis.com/v1/documents/docs.cloud.google.com/run/docs/overview/what-is-cloud-run?key=${DEVELOPERKNOWLEDGE_API_KEY}"
  • Batch Get Documents:
    bash
    curl -s -X POST "https://developerknowledge.googleapis.com/v1/documents:batchGet?key=${DEVELOPERKNOWLEDGE_API_KEY}" \
      -H "Content-Type: application/json" \
      -d '{"names": ["documents/docs.cloud.google.com/run/docs/overview/what-is-cloud-run"]}'
当环境中未声明MCP工具时,使用HTTP请求(
curl
)调用Developer Knowledge REST API(
https://developerknowledge.googleapis.com/v1
),并使用环境API密钥(
DEVELOPERKNOWLEDGE_API_KEY
):
  • Answer Query:
    bash
    curl -s -X POST "https://developerknowledge.googleapis.com/v1:answerQuery?key=${DEVELOPERKNOWLEDGE_API_KEY}" \
      -H "Content-Type: application/json" \
      -d '{"query": "How do I configure public read access on Cloud Storage?"}'
  • Search Document Chunks(使用2–5个聚焦关键词):
    bash
    curl -s "https://developerknowledge.googleapis.com/v1/documents:searchDocumentChunks?query=gcloud+logging+metrics+create&key=${DEVELOPERKNOWLEDGE_API_KEY}"
  • Get Document:
    bash
    curl -s "https://developerknowledge.googleapis.com/v1/documents/docs.cloud.google.com/run/docs/overview/what-is-cloud-run?key=${DEVELOPERKNOWLEDGE_API_KEY}"
  • Batch Get Documents:
    bash
    curl -s -X POST "https://developerknowledge.googleapis.com/v1/documents:batchGet?key=${DEVELOPERKNOWLEDGE_API_KEY}" \
      -H "Content-Type: application/json" \
      -d '{"names": ["documents/docs.cloud.google.com/run/docs/overview/what-is-cloud-run"]}'

Synthesis & Output Guidelines

整合与输出指南

  1. Grounding in Official Documentation: Ground all solutions directly in retrieved documentation. Official documentation conventions have absolute precedence over memorized defaults.
  2. Exact Parameter Formatting: Format CLI flags, composite keys (e.g.
    location=IP:PATH
    ), and IAM permission strings according to official Google specifications.
  3. Complete Solutions in Final Response: Always output the full, self-contained, executable technical solution (commands, configurations, or code snippets) with clear standard placeholders (e.g.
    PROJECT_ID
    ,
    SERVICE_NAME
    ,
    REGION
    ) directly in your final message, even if previously referenced during internal planning.
  1. 基于官方文档:所有解决方案均需直接基于检索到的文档。官方文档约定优先于记忆中的默认内容。
  2. 精确参数格式:按照谷歌官方规范格式化CLI标志、复合键(例如
    location=IP:PATH
    )及IAM权限字符串。
  3. 在最终回复中输出完整解决方案:始终在最终消息中输出完整、独立且可执行的技术解决方案(命令、配置或代码片段),并使用清晰的标准占位符(例如
    PROJECT_ID
    SERVICE_NAME
    REGION
    ),即使在内部规划阶段已提及相关内容。

References

参考资料

  • MCP Usage & Tool Details
  • REST API Fallback Guide
  • Supported Domains & Scoping
  • MCP使用与工具详情
  • REST API备选方案指南
  • 支持的域名与范围