Skip to main content
Glama
gemini-dk

Firebase MCP Server

by gemini-dk

firestore_delete_document

Remove a specific document from a Firestore collection by providing the collection name and document ID.

Instructions

Delete a document from a Firestore collection

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
collectionYesCollection name
idYesDocument ID

Implementation Reference

  • The core handler function that deletes the specified Firestore document and handles errors or missing initialization.
    export async function deleteDocument(collection: string, id: string) {
      try {
        if (!db) {
          return { content: [{ type: 'text', text: 'Firebase is not initialized. SERVICE_ACCOUNT_KEY_PATH environment variable is required.' }], isError: true };
        }
        
        await db.collection(collection).doc(id).delete();
        return { content: [{ type: 'text', text: 'Document deleted successfully' }] };
      } catch (error) {
        return { content: [{ type: 'text', text: `Error deleting document: ${(error as Error).message}` }], isError: true };
      }
    }
  • Defines the input schema for the firestore_delete_document tool, specifying collection and id parameters.
    {
      name: 'firestore_delete_document',
      description: 'Delete a document from a Firestore collection',
      inputSchema: {
        type: 'object',
        properties: {
          collection: {
            type: 'string',
            description: 'Collection name'
          },
          id: {
            type: 'string',
            description: 'Document ID'
          }
        },
        required: ['collection', 'id']
      }
    },
  • src/index.ts:242-243 (registration)
    Registers the tool handler in the CallToolRequestSchema switch statement by calling the deleteDocument function.
    case 'firestore_delete_document':
      return deleteDocument(args.collection as string, args.id as string);
  • src/index.ts:163-180 (registration)
    Registers the tool in the ListToolsRequestSchema response, including name, description, and schema.
    {
      name: 'firestore_delete_document',
      description: 'Delete a document from a Firestore collection',
      inputSchema: {
        type: 'object',
        properties: {
          collection: {
            type: 'string',
            description: 'Collection name'
          },
          id: {
            type: 'string',
            description: 'Document ID'
          }
        },
        required: ['collection', 'id']
      }
    },
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries the full burden of behavioral disclosure. It states the action ('Delete') but lacks details on permissions needed, whether deletion is permanent, error handling (e.g., if document doesn't exist), or rate limits, which are critical for a destructive operation.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, efficient sentence with zero waste, front-loading the key action and resource. It's appropriately sized for a simple tool, making it easy to parse quickly.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the complexity of a destructive operation with no annotations and no output schema, the description is incomplete. It fails to address critical aspects like return values, error conditions, or safety warnings, leaving significant gaps for an AI agent to handle correctly.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, so the schema already documents both parameters ('collection' and 'id') adequately. The description doesn't add any meaning beyond what the schema provides, such as format examples or constraints, meeting the baseline for high coverage.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the verb ('Delete') and resource ('a document from a Firestore collection'), making the tool's purpose immediately understandable. However, it doesn't differentiate from sibling tools like 'firestore_update_document' or 'firestore_add_document' beyond the action name, missing explicit comparison.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

No guidance is provided on when to use this tool versus alternatives. It doesn't mention prerequisites (e.g., document must exist), exclusions, or comparisons to siblings like 'firestore_update_document' for modifications, leaving usage context implied.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

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/gemini-dk/mcp-server-firebase'

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