1
---
2
name: retrieving-developer-knowledge
3
metadata:
4
version: "1.0.2"
5
category: CloudInfrastructureAndServices
6
description: >-
7
Searches, retrieves, and synthesizes official Google developer documentation across Google Cloud,
8
AI/Gemini, Android, Chrome, Web, Flutter, Go, Firebase, and other Google developer platforms.
9
Integrates with the Developer Knowledge MCP server (search_documents, get_documents, answer_query)
10
or the Developer Knowledge REST API fallback. Use when searching for gcloud CLI commands, API syntax,
11
IAM permissions, official documentation, architectural comparisons, or product choice overviews.
12
Don't use for local filesystem lookups or non-Google documentation.
13
---
14
15
# Google Developer Knowledge
16
17
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.
18
19
## Usage Attribution
20
21
Before executing any `gcloud`, REST API, or MCP command with this skill, follow
22
the instructions in [Usage Attribution](references/attribution.md).
23
24
## Workflow
25
26
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):
27
- **If MCP tools are present in your environment**: Call `answer_query` (for conceptual guides/workflows) or `search_documents` (for CLI flags/syntax).
28
- **If MCP tools are not present**: Execute a REST API request via `curl` against `https://developerknowledge.googleapis.com/v1`.
29
- **A declared server is not always a connected server.** Some clients cannot complete the MCP handshake with this server and expose no `answer_query`, `search_documents` or `get_documents` tool at all, even though the plugin declares one. Treat their absence as normal and use the REST fallback below.
30
2. **Confirm the lookup succeeded before using it**: A response that arrives is not automatically an answer. `PERMISSION_DENIED`, `UNAUTHENTICATED`, HTTP 401 or 403, an empty result set, or any error payload is a FAILED lookup even when the tool itself reported no error. On a failed lookup, do not answer as though it had succeeded.
31
- **Rate Limits (HTTP 429 / Out of Quota)**: If calling `answer_query` or the REST `:answerQuery` endpoint returns an HTTP 429 (`RESOURCE_EXHAUSTED` / out of quota error), this indicates server-side generative QA quota exhaustion. Do not treat this as an unrecoverable failure or fall back to ungrounded memory; immediately retry using the search endpoint (`search_documents` for MCP, or `documents:searchDocumentChunks` for REST) with 2–5 focused keywords from the query.
32
- **Persistent Failures**: Try the other transport once, and if that also fails, state plainly in your reply to the user that you could not reach Developer Knowledge and are answering without it. Presenting recalled documentation as a retrieved result is the worst available outcome, because nothing in the reply distinguishes it from a real lookup.
33
3. **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.
34
35
## Tool Selection & Usage
36
37
Choose the appropriate tool based on availability in your runtime environment:
38
39
### 1. Developer Knowledge MCP Tools (Preferred)
40
When MCP tools are present in your active tool definitions:
41
- **`answer_query(query="...")`**: Use for conceptual guides, architectural comparisons, product choice overviews, and multi-step workflows. This tool has limited quota. If you get a 429 out of quota error, use `search_documents` instead.
42
- **`search_documents(query="...")`**: 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.
43
- **`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"]`).
44
45
### 2. REST API Fallback
46
When the MCP tools are absent, query the Developer Knowledge REST API
47
(`https://developerknowledge.googleapis.com/v1`) with `curl`. Two credentials
48
work, and you should try them in this order.
49
50
**An existing Google credential, preferred.** If `gcloud` is authenticated,
51
pass a bearer token and your quota project. Nothing needs to be installed or
52
configured:
53
54
```bash
55
curl -s -X POST "https://developerknowledge.googleapis.com/v1:answerQuery" \
56
-H "Authorization: Bearer $(gcloud auth print-access-token)" \
57
-H "X-Goog-User-Project: $(gcloud config get-value project 2>/dev/null)" \
58
-H "Content-Type: application/json" \
59
-d "{\"query\": \"How do I configure public read access on Cloud Storage?\"}"
60
```
61
62
If that fails to authenticate, on a 401, a 403, or any other credential error,
63
the account has a token the API will not accept. Substitute
64
`gcloud auth application-default print-access-token` for
65
`gcloud auth print-access-token` in the command above and try again. Which
66
credential the API accepts depends on how the environment was authenticated, so
67
treat an auth error here as a reason to try the application-default credential
68
rather than as a failed lookup.
69
70
**An API key, if one is configured.** Where `DEVELOPERKNOWLEDGE_API_KEY` is set
71
in the environment, pass it as a `key` query parameter instead of an
72
`Authorization` header. If neither credential is available, an API key is the
73
supported path for this client: enable the API and create one by following the
74
[Developer Knowledge quickstart](https://developers.google.com/knowledge/quickstart),
75
then export it as `DEVELOPERKNOWLEDGE_API_KEY`. Say that you need a credential
76
rather than answering without a lookup. The remaining examples in this section
77
use that form:
78
- **Answer Query**:
79
```bash
80
curl -s -X POST "https://developerknowledge.googleapis.com/v1:answerQuery?key=${DEVELOPERKNOWLEDGE_API_KEY}" \
81
-H "Content-Type: application/json" \
82
-d '{"query": "How do I configure public read access on Cloud Storage?"}'
83
```
84
This endpoint has limited quota. If you get a 429 out of quota error, use `documents:searchDocumentChunks` instead.
85
- **Search Document Chunks** (use 2–5 focused keywords):
86
```bash
87
curl -s "https://developerknowledge.googleapis.com/v1/documents:searchDocumentChunks?query=gcloud+logging+metrics+create&key=${DEVELOPERKNOWLEDGE_API_KEY}"
88
```
89
- **Get Document**:
90
```bash
91
curl -s "https://developerknowledge.googleapis.com/v1/documents/docs.cloud.google.com/run/docs/overview/what-is-cloud-run?key=${DEVELOPERKNOWLEDGE_API_KEY}"
92
```
93
- **Batch Get Documents** (a `GET`, with one `names` parameter per document and no
94
request body; up to 20 per call):
95
```bash
96
curl -s -G "https://developerknowledge.googleapis.com/v1/documents:batchGet" \
97
--data-urlencode "names=documents/docs.cloud.google.com/run/docs/overview/what-is-cloud-run" \
98
--data-urlencode "names=documents/docs.cloud.google.com/storage/docs/creating-buckets" \
99
--data-urlencode "key=${DEVELOPERKNOWLEDGE_API_KEY}"
100
```
101
102
## Synthesis & Output Guidelines
103
104
1. **Grounding in Official Documentation**: Ground all solutions directly in retrieved documentation. Official documentation conventions have absolute precedence over memorized defaults.
105
2. **Exact Parameter Formatting**: Format CLI flags, composite keys (e.g. `location=IP:PATH`), and IAM permission strings according to official Google specifications.
106
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.
107
108
## References
109
110
- [Usage Attribution](references/attribution.md)
111
- [MCP Usage & Tool Details](references/mcp-usage.md)
112
- [REST API Fallback Guide](references/api-fallback.md)
113
- [Supported Domains & Scoping](references/supported-domains.md)
114