Skip to content

Commit 8d0c38f

Browse files
author
CodeBuddy Attribution Bot
committed
fix(attribution): MCP工具在多步串联操作场景下可发现性不足,模型未发起任何实际MCP调用 (issue_mocmz9tl_ss16ci)
1 parent 36f1dc1 commit 8d0c38f

2 files changed

Lines changed: 87 additions & 0 deletions

File tree

config/source/guideline/cloudbase/SKILL.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,13 +52,15 @@ If a skill points to its own `references/...` files, keep following those relati
5252
| AI Agent (智能体开发) | `cloudbase-agent` | domain skill as needed | `cloud-functions`,`cloudrun-development`, | AG-UI protocol, scf_bootstrap, SSE streaming |
5353
| UI generation | `ui-design` | platform skill | backend-only skills | Design specification first |
5454
| Spec workflow / architecture design | `spec-workflow` | `cloudbase` and platform skill | direct implementation skills | Requirements, design, tasks confirmed |
55+
| NoSQL direct MCP operations (check / create / insert / query without writing SDK code) | `cloudbase-platform` | `no-sql-web-sdk` or `no-sql-wx-mp-sdk` (for SDK code only) | `auth-web`, `http-api` | Collection must exist before data operations; use `checkCollection``createCollection` → insert → query sequence |
5556
| Resource health inspection / troubleshooting / 巡检 / 诊断 | `ops-inspector` | `cloud-functions`, `cloudrun-development` | `ui-design`, `spec-workflow` | CLS enabled, time range for logs |
5657

5758
### Routing reminders
5859

5960
- Web auth failures are usually caused by skipping provider configuration, not by missing frontend code snippets.
6061
- Native App failures are usually caused by reading Web SDK paths, not by missing HTTP API knowledge.
6162
- Mini program failures are usually caused by treating `wx.cloud` like Web auth or Web SDK.
63+
- NoSQL MCP operation failures are usually caused by the model generating SDK code (`db.collection(...)`) instead of calling the MCP tools (`readNoSqlDatabaseStructure`, `writeNoSqlDatabaseStructure`, `readNoSqlDatabaseContent`, `writeNoSqlDatabaseContent`) directly. When the task says to operate on a collection via MCP, call the tools — do not write JavaScript.
6264

6365
### Web SDK quick reminder
6466

@@ -284,6 +286,15 @@ Prefer long-term memory when available: write the scenarios and working rules th
284286
- NoSQL Database: Refer to the `no-sql-wx-mp-sdk` skill
285287
- MySQL Relational Database: Refer to the `relational-database-tool` skill (via tools)
286288

289+
**Direct MCP Tool Operations (no SDK code):**
290+
- When the task requires operating NoSQL collections directly via MCP tools (not writing browser/mini-program code), use these 4 tools:
291+
- `readNoSqlDatabaseStructure` — check/list/describe collections and indexes
292+
- `writeNoSqlDatabaseStructure` — create/update/delete collections and indexes
293+
- `readNoSqlDatabaseContent` — query documents from a collection
294+
- `writeNoSqlDatabaseContent` — insert/update/delete documents
295+
- Read the `cloudbase-platform` skill for the full multi-step workflow and call examples
296+
- **Do NOT** generate `db.collection(...)` SDK code when the task expects direct MCP tool calls
297+
287298
### 3. Deployment
288299

289300
**Static Hosting (Web):**

config/source/skills/cloudbase-platform/SKILL.md

Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -195,6 +195,82 @@ Compatibility note:
195195
- If involving cloud functions, while ensuring security, can minimize the number of cloud functions as much as possible
196196
- For example: implement one cloud function for client-side requests, implement one cloud function for data initialization
197197

198+
## NoSQL Database MCP Tool Operations
199+
200+
When using CloudBase MCP tools directly (not writing browser/mini-program SDK code), use these 4 tools for NoSQL database operations:
201+
202+
### Tool Overview
203+
204+
| Tool | Purpose | Key actions |
205+
|------|---------|-------------|
206+
| `readNoSqlDatabaseStructure` | Read collection and index structure | `listCollections`, `describeCollection`, `checkCollection`, `listIndexes`, `checkIndex` |
207+
| `writeNoSqlDatabaseStructure` | Create, update, or delete collections and indexes | `createCollection`, `updateCollection`, `deleteCollection` |
208+
| `readNoSqlDatabaseContent` | Query documents from a collection | Query with filters, projection, sort, pagination |
209+
| `writeNoSqlDatabaseContent` | Insert, update, or delete documents | `insert`, `update`, `delete` |
210+
211+
### Typical Multi-Step Workflow
212+
213+
For common NoSQL operations that require chaining multiple tool calls, follow this sequence:
214+
215+
```
216+
1. Check collection exists → readNoSqlDatabaseStructure(action="checkCollection", collectionName="...")
217+
2. If not exists, create collection → writeNoSqlDatabaseStructure(action="createCollection", collectionName="...")
218+
3. Verify/describe collection → readNoSqlDatabaseStructure(action="describeCollection", collectionName="...")
219+
4. Insert documents → writeNoSqlDatabaseContent(action="insert", collectionName="...", documents=[{...}])
220+
5. Query documents → readNoSqlDatabaseContent(collectionName="...", query={...})
221+
```
222+
223+
**Important**: After `createCollection`, the tool internally waits for the collection to become ready before returning. You do NOT need to add a separate delay or retry loop.
224+
225+
### Call Examples
226+
227+
**Check if a collection exists:**
228+
```
229+
readNoSqlDatabaseStructure(action="checkCollection", collectionName="my_collection")
230+
```
231+
232+
**Create a collection:**
233+
```
234+
writeNoSqlDatabaseStructure(action="createCollection", collectionName="my_collection")
235+
```
236+
237+
**Describe a collection (includes index info):**
238+
```
239+
readNoSqlDatabaseStructure(action="describeCollection", collectionName="my_collection")
240+
```
241+
242+
**List all collections:**
243+
```
244+
readNoSqlDatabaseStructure(action="listCollections")
245+
```
246+
247+
**Insert a document:**
248+
```
249+
writeNoSqlDatabaseContent(action="insert", collectionName="my_collection", documents=[{"name":"test","status":"active"}])
250+
```
251+
252+
**Query documents with a filter:**
253+
```
254+
readNoSqlDatabaseContent(collectionName="my_collection", query={"name":"test"})
255+
```
256+
257+
**Update documents (use `$set` for partial updates):**
258+
```
259+
writeNoSqlDatabaseContent(action="update", collectionName="my_collection", query={"name":"test"}, update={"$set":{"status":"completed"}})
260+
```
261+
262+
**Delete documents:**
263+
```
264+
writeNoSqlDatabaseContent(action="delete", collectionName="my_collection", query={"name":"test"})
265+
```
266+
267+
### Common Mistakes
268+
269+
- **Forgetting to create the collection first**: All content operations (`readNoSqlDatabaseContent`, `writeNoSqlDatabaseContent`) require the collection to already exist. Always check with `checkCollection` and create with `createCollection` if needed before doing data operations.
270+
- **Using `update` without `$set`**: When updating documents, passing a plain object like `{"status":"completed"}` will **replace the entire document**. Use `{"$set":{"status":"completed"}}` for partial updates.
271+
- **Mixing SDK code patterns with MCP tool calls**: When in pure MCP mode, do NOT generate JavaScript code using `db.collection(...)`. Call the MCP tools directly instead.
272+
- **Not chaining operations sequentially**: Multi-step operations (check → create → insert → query) must be done in order; each step may depend on the previous step's result.
273+
198274
## Data Models
199275

200276
1. **Get Data Model Operation Object**:

0 commit comments

Comments
 (0)