Skip to main content
Glama
fadlee

PocketBase MCP Server

by fadlee

truncate_collection

Delete all records from a specified PocketBase collection to clear data while preserving the collection structure.

Instructions

Delete all records associated with the specified collection

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
collectionYesCollection name or ID to truncate (delete all records)

Implementation Reference

  • The main handler function for the 'truncate_collection' tool. It calls PocketBase's truncate method to delete all records in the specified collection.
    export function createTruncateCollectionHandler(pb: PocketBase): ToolHandler {
      return async (args: TruncateCollectionArgs) => {
        try {
          await pb.collections.truncate(args.collection);
          return createJsonResponse({
            success: true,
            message: `All records in collection '${args.collection}' have been deleted`
          });
        } catch (error: unknown) {
          throw handlePocketBaseError("truncate collection", error);
        }
      };
    }
  • src/server.ts:118-123 (registration)
    Registers the 'truncate_collection' tool in the MCP server, associating it with its schema and handler.
      name: "truncate_collection",
      description: "Delete all records associated with the specified collection",
      inputSchema: truncateCollectionSchema,
      handler: createTruncateCollectionHandler(pb),
    },
  • Defines the input schema for the 'truncate_collection' tool, requiring a 'collection' string parameter.
    export const truncateCollectionSchema = {
      type: "object",
      properties: {
        collection: {
          type: "string",
          description: "Collection name or ID to truncate (delete all records)",
        },
      },
      required: ["collection"],
    };
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. While it correctly indicates a destructive operation ('Delete all records'), it fails to mention critical aspects: whether this requires specific permissions, if the action is reversible, what happens to the collection structure itself, or any rate limits. For a high-impact mutation tool, this is insufficient.

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 that directly states the tool's function without any fluff. Every word earns its place, and the information is front-loaded with the core action and target. It's optimally concise for a simple, single-parameter tool.

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 this is a destructive mutation tool with no annotations and no output schema, the description is incomplete. It doesn't address permissions, reversibility, effects on collection metadata, or return values. For a tool that permanently deletes all records in a collection, more contextual warning and behavioral detail are needed.

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

Parameters4/5

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

The description adds meaningful context beyond the 100% schema coverage by clarifying that the parameter represents 'Collection name or ID to truncate' and specifying the effect ('delete all records'). This reinforces the schema's description while providing additional semantic understanding of what the parameter controls in the operation.

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

Purpose5/5

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

The description clearly states the specific action ('Delete all records') and target resource ('associated with the specified collection'), distinguishing it from siblings like delete_collection (which likely deletes the collection itself) and delete_record (which deletes individual records). The verb+resource combination is precise and unambiguous.

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?

The description provides no guidance on when to use this tool versus alternatives like delete_collection or delete_record. It doesn't mention prerequisites, exclusions, or comparative use cases, leaving the agent to infer usage from the name alone. This is a significant gap for a destructive operation among multiple related tools.

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/fadlee/dynamic-pocketbase-mcp'

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