Skip to main content
Glama
delete.ts1.55 kB
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js"; import { z } from "zod"; import { FirestoreClient } from "../firestore/client.js"; import { PermissionManager } from "../permissions/manager.js"; export function registerDeleteTools( server: McpServer, firestoreClient: FirestoreClient, permissionManager: PermissionManager ) { // Delete document tool server.tool( "firestore-delete-document", "Delete a document from Firestore", { collectionId: z.string().describe("The ID of the collection"), documentId: z.string().describe("The ID of the document to delete") }, async ({ collectionId, documentId }) => { // Check permissions if (!permissionManager.hasPermission(collectionId, 'delete')) { return { isError: true, content: [{ type: "text", text: `Access denied to delete document: ${collectionId}/${documentId}` }] }; } try { await firestoreClient.deleteDocument(collectionId, documentId); return { content: [{ type: "text", text: `Successfully deleted document ${documentId} from collection ${collectionId}` }] }; } catch (error) { return { isError: true, content: [{ type: "text", text: `Error deleting document ${collectionId}/${documentId}: ${error instanceof Error ? error.message : String(error)}` }] }; } } ); }

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/devlimelabs/firestore-mcp'

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