delete_json_doc_from_db
Remove a JSON document by its ID from a specified database on the MCP JSON Document Collection Server, enabling efficient document management.
Instructions
Delete a JSON document by ID from a document database
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| databaseName | No | name of document database to delete from | |
| id | No | ID of document to delete |
Input Schema (JSON Schema)
{
"properties": {
"databaseName": {
"description": "name of document database to delete from",
"type": "string"
},
"id": {
"description": "ID of document to delete",
"type": "string"
}
},
"type": "object"
}
Implementation Reference
- src/index.ts:460-482 (handler)Handler function for the delete_json_doc_from_db tool. Parses arguments using the schema, retrieves or initializes the database, deletes the document by ID using db.del(), and returns a success message.case "delete_json_doc_from_db": { const parsed = DeleteJsonDocFromDbArgsSchema.safeParse(args); if (!parsed.success) { throw new Error(`Invalid arguments for delete_json_doc_from_db: ${parsed.error}`); } const dbName = parsed.data.databaseName; if (!dbs[dbName]) { const newDb = fireproof(dbName); dbs[dbName] = { db: newDb }; } const db = dbs[dbName].db; await db.del(parsed.data.id); return { content: [ { type: "text", text: `Deleted document with ID: ${parsed.data.id}`, }, ], }; }
- src/index.ts:88-91 (schema)Zod schema defining the input arguments for the delete_json_doc_from_db tool: databaseName (string) and id (string). Used for validation in the handler.const DeleteJsonDocFromDbArgsSchema = z.object({ databaseName: z.string(), id: z.string(), });
- src/index.ts:172-188 (registration)Tool registration in the listTools response, including name, description, and inputSchema (JSON Schema matching the Zod schema).{ name: "delete_json_doc_from_db", description: "Delete a JSON document by ID from a document database", inputSchema: { type: "object", properties: { id: { type: "string", description: "ID of document to delete", }, databaseName: { type: "string", description: "name of document database to delete from", }, } }, },