Skip to main content
Glama
fadlee

PocketBase MCP Server

by fadlee

update_record

Modify existing records in PocketBase collections by specifying the record ID and updated field values, with options to control response fields and expand related data.

Instructions

Update an existing record

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
collectionYesCollection name
dataYesUpdated record data with field values matching the collection schema. Can use field modifiers like fieldName+, +fieldName, fieldName-.
expandNoComma-separated list of relation fields to expand in the response (e.g. 'author,comments.user')
fieldsNoComma-separated fields to return in the response (e.g. 'id,title,author')
idYesRecord ID

Implementation Reference

  • The core handler function that executes the update_record tool logic using PocketBase's update method on the specified collection and record ID.
    export function createUpdateRecordHandler(pb: PocketBase): ToolHandler {
      return async (args: UpdateRecordArgs) => {
        try {
          const options: any = {};
          
          // Add optional parameters
          if (args.expand) options.expand = args.expand;
          if (args.fields) options.fields = args.fields;
          
          const result = await pb
            .collection(args.collection)
            .update(args.id, args.data, options);
          
          return createJsonResponse(result);
        } catch (error: unknown) {
          throw handlePocketBaseError("update record", error);
        }
      };
    }
  • The input schema definition for the update_record tool, specifying required and optional parameters for validation.
    export const updateRecordSchema = {
      type: "object",
      properties: {
        collection: {
          type: "string",
          description: "Collection name",
        },
        id: {
          type: "string",
          description: "Record ID",
        },
        data: {
          type: "object",
          description: "Updated record data with field values matching the collection schema. Can use field modifiers like fieldName+, +fieldName, fieldName-.",
        },
        expand: {
          type: "string",
          description: "Comma-separated list of relation fields to expand in the response (e.g. 'author,comments.user')",
        },
        fields: {
          type: "string",
          description: "Comma-separated fields to return in the response (e.g. 'id,title,author')",
        },
      },
      required: ["collection", "id", "data"],
    };
  • src/server.ts:137-142 (registration)
    The registration of the update_record tool in the MCP server, linking the name, schema, and handler.
    {
      name: "update_record",
      description: "Update an existing record",
      inputSchema: updateRecordSchema,
      handler: createUpdateRecordHandler(pb),
    },
Behavior2/5

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

No annotations are provided, so the description carries the full burden of behavioral disclosure. 'Update an existing record' implies a mutation operation, but it doesn't specify permissions required, whether changes are reversible, rate limits, error handling, or what the response contains. For a mutation tool with zero annotation coverage, this is a significant gap in transparency.

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—it directly states the tool's action without unnecessary elaboration. It's appropriately sized and front-loaded, making it easy for an agent 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 mutation tool with 5 parameters, no annotations, and no output schema, the description is inadequate. It fails to address behavioral aspects like side effects, error conditions, or response format, leaving the agent with insufficient context to use the tool effectively beyond basic parameter passing.

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 all 5 parameters thoroughly. The description adds no additional meaning beyond implying that parameters are needed for the update, which is redundant. This meets the baseline score of 3, as the schema does the heavy lifting without requiring compensation from the description.

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 'Update an existing record' clearly states the verb ('update') and resource ('record'), making the purpose immediately understandable. However, it doesn't differentiate this tool from sibling tools like 'create_record' or 'delete_record' beyond the basic action, missing an opportunity to specify what distinguishes an update operation from other record modifications.

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. It doesn't mention prerequisites (e.g., needing an existing record ID), exclusions (e.g., not for creating new records), or comparisons to siblings like 'create_record' or 'delete_record', leaving the agent to infer usage from context alone.

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