Skip to main content
Glama
jimpick

MCP JSON Document Collection Server

by jimpick

delete_json_doc_from_db

Remove a JSON document from a database by specifying its unique ID, enabling document management and cleanup in Fireproof JSON databases.

Instructions

Delete a JSON document by ID from a document database

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
idNoID of document to delete
databaseNameNoname of document database to delete from

Implementation Reference

  • The handler logic for the 'delete_json_doc_from_db' tool. It validates input using DeleteJsonDocFromDbArgsSchema, ensures the database exists (creating if necessary), 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}`, }, ], }; }
  • 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, specifying name, description, and input schema (JSON Schema object).
    { 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", }, } }, },
  • JSON Schema in the tool registration for input validation, matching the Zod schema structure.
    type: "object", properties: { id: { type: "string", description: "ID of document to delete", }, databaseName: { type: "string", description: "name of document database to delete from", }, }

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/jimpick/mcp-json-db-collection-server'

If you have feedback or need assistance with the MCP directory API, please join our Discord server