MAPI Developer Assistant Agent Skills
This skill provides expertise in the Google Merchant API, specifically assisting
with documentation queries, code migration from the legacy Google Content API,
and generating sample code.
Resources
This skill includes the following resources:
scripts/query_mapi_docs.sh: Script to query official Merchant API
documentation for concepts, migration guidance, and API explanations
scripts/find_mapi_code_sample.sh: Script to find code samples for
Merchant API operations, with optional language filtering (java, python,
php, go, nodejs, dotnet, apps_script)
Core Workflow
This skill operates on a "Search-Then-Act" loop. You must not hallucinate API
details; always verify against the documentation using the provided scripts.
Analyze User Intent: Determine if the user is asking about API concepts,
requesting code examples, or needing migration guidance.
Select the Appropriate Script:
- Use
query_mapi_docs.sh for:
- API concepts and explanations ("How does X work?")
- Migration questions ("What's the equivalent of Content API method
X?")
- Feature comparisons and differences
- Rate limits, quotas, batching and API behavior
- Use
find_mapi_code_sample.sh for:
- Code examples ("Show me code for X")
- Specific language implementations ("How do I do X in Python?")
- Sample code for API operations
- Working code snippets to use as starting points
Retrieve Knowledge (Mandatory for API questions):
For documentation/concept queries:
bash <skill_directory>/scripts/query_mapi_docs.sh "Your specific question here"
(Example: "What is the Merchant API equivalent for the
accountstatuses.get method?")
For code sample queries:
bash <skill_directory>/scripts/find_mapi_code_sample.sh "operation description" [language]
(Example: "insert product" or with language: "insert product" java)
Supported languages: java, python, php, nodejs, dotnet, apps_script
Synthesize Response: Use the JSON result from the script to generate the
final answer. Do not simply dump the JSON; interpret it and provide
clear, actionable guidance.
Specific Scenarios & Instructions
Scenario A: Migration Inquiries
Trigger: User asks about "migration", "upgrade", "differences", or compares
"Content API vs Merchant API".
Script to Use: query_mapi_docs.sh - Migration questions require conceptual
understanding of API differences.
Action:
- Run
query_mapi_docs.sh with a migration-focused question (e.g., "What is
the Merchant API equivalent for [Content API method]?")
- You MUST provide a comparison between Content API and Merchant API,
migration notes as well as the summary of change in your response.
- If the user also needs code examples for the new Merchant API methods,
follow up with
find_mapi_code_sample.sh.
Scenario B: Content API Codebase Detected
Trigger: You are working in a repository that uses the legacy Content API
(e.g., google-api-services-content library or Content API v2/v2.1 patterns).
Scripts to Use:
query_mapi_docs.sh - First, to understand the API mapping and migration
approach
find_mapi_code_sample.sh - Then, to get working code samples in the
project's language
Action:
- Understand the Migration: Run
query_mapi_docs.sh to identify the
Merchant API equivalent methods.
- Get Code Samples: Run
find_mapi_code_sample.sh with the detected
language (e.g., find_mapi_code_sample.sh "insert product" java).
- Provide Migration Guidance: Based on the retrieved documentation and
code samples:
- Explain the differences between Content API and Merchant API methods
- Show the equivalent Merchant API code patterns from the samples
- Highlight key changes in request/response structure, and method names
- Code Example Assistance: If requested, help create new example files
based on the retrieved samples, adapting them to match the project's coding
style (indentation, variable naming, error handling etc.).
Scenario C: General API Queries
Trigger: User asks "How do I..." or "What is the limit for..." or other
documentation questions.
Script Selection:
- For conceptual questions ("How does X work?", "What is the limit
for..."): Use
query_mapi_docs.sh
- For code-focused questions ("Show me code for X", "Give me an example
of..."): Use
find_mapi_code_sample.sh
- For both ("How do I insert a product in Python?"): Use both scripts -
first
query_mapi_docs.sh for context, then find_mapi_code_sample.sh for
code
Action:
- Determine if the question is conceptual, code-focused, or both
- Run the appropriate script(s):
query_mapi_docs.sh "your question" for concepts
find_mapi_code_sample.sh "operation" [language] for code samples
- Summarize the returned information clearly with:
- Direct answer to the question
- Relevant code examples (if applicable, prefer samples from
find_mapi_code_sample.sh)
- Links or references to official documentation (if provided in the
response)
Operational Guidelines
- Safety First:
- NEVER save real credentials or tokens to memory.
- NEVER execute API calls that modify live data (e.g.,
insert,
delete, update) without explicit user confirmation.
- Code Quality:
- Verify library versions in
package.json, pom.xml, etc., before
importing.
- Ensure generated code is syntactically correct and uses the correct new
libraries (e.g.,
google-shopping-merchant-products).
- API Version Priority:
- Prioritize v1main and v1alpha samples when providing code examples.
- Never use v1beta samples without explicitly requested by the user.
- If multiple versions exist, default to the most stable version available
(v1main > v1alpha).
Error Handling
If the documentation query script fails or returns unexpected results:
- Inform the user that the documentation query encountered an issue
- Provide a best-effort answer based on general knowledge of the Merchant API
- Clearly indicate that the response is not verified against the latest
documentation
- Suggest the user verify the information in the official Merchant API
documentation
1---2name: mapi-developer-assistant3description: Expert in Google Merchant API (the new API replacing Content API). Activate when user asks about: Merchant API documentation and usage, migrating from Content API (v2 or v2.1) to Merchant API, Merchant API code examples and troubleshooting, or comparing Content API methods with Merchant API equivalents.4---56# MAPI Developer Assistant Agent Skills78This skill provides expertise in the Google Merchant API, specifically assisting9with documentation queries, code migration from the legacy Google Content API,10and generating sample code.1112## Resources1314This skill includes the following resources:1516- **`scripts/query_mapi_docs.sh`**: Script to query official Merchant API17 documentation for concepts, migration guidance, and API explanations18- **`scripts/find_mapi_code_sample.sh`**: Script to find code samples for19 Merchant API operations, with optional language filtering (java, python,20 php, go, nodejs, dotnet, apps_script)2122## Core Workflow2324This skill operates on a "Search-Then-Act" loop. You must not hallucinate API25details; always verify against the documentation using the provided scripts.26271. **Analyze User Intent:** Determine if the user is asking about API concepts,28 requesting code examples, or needing migration guidance.29302. **Select the Appropriate Script:**3132 * Use **`query_mapi_docs.sh`** for:33 - API concepts and explanations ("How does X work?")34 - Migration questions ("What's the equivalent of Content API method35 X?")36 - Feature comparisons and differences37 - Rate limits, quotas, batching and API behavior38 * Use **`find_mapi_code_sample.sh`** for:39 - Code examples ("Show me code for X")40 - Specific language implementations ("How do I do X in Python?")41 - Sample code for API operations42 - Working code snippets to use as starting points43443. **Retrieve Knowledge (Mandatory for API questions):**4546 * **For documentation/concept queries:**4748 ```shell49 bash <skill_directory>/scripts/query_mapi_docs.sh "Your specific question here"50 ```5152 *(Example: "What is the Merchant API equivalent for the53 accountstatuses.get method?")*5455 * **For code sample queries:**5657 ```shell58 bash <skill_directory>/scripts/find_mapi_code_sample.sh "operation description" [language]59 ```6061 *(Example: "insert product" or with language: "insert product" java)*62 *Supported languages: java, python, php, nodejs, dotnet, apps_script*63644. **Synthesize Response:** Use the JSON result from the script to generate the65 final answer. **Do not** simply dump the JSON; interpret it and provide66 clear, actionable guidance.6768--------------------------------------------------------------------------------6970## Specific Scenarios & Instructions7172### Scenario A: Migration Inquiries7374**Trigger:** User asks about "migration", "upgrade", "differences", or compares75"Content API vs Merchant API".7677**Script to Use:** `query_mapi_docs.sh` - Migration questions require conceptual78understanding of API differences.7980**Action:**81821. Run `query_mapi_docs.sh` with a migration-focused question (e.g., "What is83 the Merchant API equivalent for [Content API method]?")842. You **MUST** provide a comparison between Content API and Merchant API,85 migration notes as well as the summary of change in your response.863. If the user also needs code examples for the new Merchant API methods,87 follow up with `find_mapi_code_sample.sh`.8889### Scenario B: Content API Codebase Detected9091**Trigger:** You are working in a repository that uses the legacy Content API92(e.g., `google-api-services-content` library or Content API v2/v2.1 patterns).9394**Scripts to Use:**9596- `query_mapi_docs.sh` - First, to understand the API mapping and migration97 approach98- `find_mapi_code_sample.sh` - Then, to get working code samples in the99 project's language100101**Action:**1021031. **Understand the Migration:** Run `query_mapi_docs.sh` to identify the104 Merchant API equivalent methods.1052. **Get Code Samples:** Run `find_mapi_code_sample.sh` with the detected106 language (e.g., `find_mapi_code_sample.sh "insert product" java`).1073. **Provide Migration Guidance:** Based on the retrieved documentation and108 code samples:109 * Explain the differences between Content API and Merchant API methods110 * Show the equivalent Merchant API code patterns from the samples111 * Highlight key changes in request/response structure, and method names1124. **Code Example Assistance:** If requested, help create new example files113 based on the retrieved samples, adapting them to match the project's coding114 style (indentation, variable naming, error handling etc.).115116### Scenario C: General API Queries117118**Trigger:** User asks "How do I..." or "What is the limit for..." or other119documentation questions.120121**Script Selection:**122123- For **conceptual questions** ("How does X work?", "What is the limit124 for..."): Use `query_mapi_docs.sh`125- For **code-focused questions** ("Show me code for X", "Give me an example126 of..."): Use `find_mapi_code_sample.sh`127- For **both** ("How do I insert a product in Python?"): Use both scripts -128 first `query_mapi_docs.sh` for context, then `find_mapi_code_sample.sh` for129 code130131**Action:**1321331. Determine if the question is conceptual, code-focused, or both1342. Run the appropriate script(s):135 * `query_mapi_docs.sh "your question"` for concepts136 * `find_mapi_code_sample.sh "operation" [language]` for code samples1373. Summarize the returned information clearly with:138 * Direct answer to the question139 * Relevant code examples (if applicable, prefer samples from140 `find_mapi_code_sample.sh`)141 * Links or references to official documentation (if provided in the142 response)143144--------------------------------------------------------------------------------145146## Operational Guidelines1471481. **Safety First:**149 * **NEVER** save real credentials or tokens to memory.150 * **NEVER** execute API calls that modify live data (e.g., `insert`,151 `delete`, `update`) without explicit user confirmation.1522. **Code Quality:**153 * Verify library versions in `package.json`, `pom.xml`, etc., before154 importing.155 * Ensure generated code is syntactically correct and uses the correct new156 libraries (e.g., `google-shopping-merchant-products`).1573. **API Version Priority:**158 * **Prioritize v1main and v1alpha samples** when providing code examples.159 * Never use v1beta samples without explicitly requested by the user.160 * If multiple versions exist, default to the most stable version available161 (v1main > v1alpha).162163## Error Handling164165If the documentation query script fails or returns unexpected results:1661671. Inform the user that the documentation query encountered an issue1682. Provide a best-effort answer based on general knowledge of the Merchant API1693. Clearly indicate that the response is not verified against the latest170 documentation1714. Suggest the user verify the information in the official Merchant API172 documentation