Skip to main content
Glama
mabeldata

PocketBase MCP Server

by mabeldata

fetch_record

Retrieve a single record from a PocketBase collection using its unique ID. Specify the collection name and record ID to access data directly.

Instructions

Fetch a single record from a PocketBase collection by ID.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
collectionYesThe name or ID of the PocketBase collection.
idYesThe ID of the record to fetch.

Implementation Reference

  • The core handler function that executes the fetch_record tool. It validates input, fetches the record from PocketBase using getOne, and returns the record as JSON string.
    async function fetchRecord(args: FetchRecordArgs, pb: PocketBase): Promise<ToolResult> {
        if (!args.collection || !args.id) {
            throw invalidParamsError("Missing required arguments: collection, id");
        }
        const record = await pb.collection(args.collection).getOne(args.id);
        return {
            content: [{ type: 'text', text: JSON.stringify(record, null, 2) }],
        };
    }
  • TypeScript interface defining the expected input arguments for the fetch_record tool: collection (string) and id (string).
    export interface FetchRecordArgs {
      collection: string;
      id: string;
    }
  • ToolInfo registration entry for 'fetch_record', including name, description, and JSON schema for input validation. Part of recordToolInfo array exported via listRecordTools().
    {
        name: 'fetch_record',
        description: 'Fetch a single record from a PocketBase collection by ID.',
        inputSchema: {
            type: 'object',
            properties: {
                collection: { type: 'string', description: 'The name or ID of the PocketBase collection.' },
                id: { type: 'string', description: 'The ID of the record to fetch.' },
            },
            required: ['collection', 'id'],
        },
    },
  • Central registration function that aggregates tool infos from all modules, including record tools containing fetch_record.
    // Combine all tool definitions
    export function registerTools(): { tools: ToolInfo[] } { // Use ToolInfo[]
        const tools: ToolInfo[] = [ // Use ToolInfo[]
            ...listRecordTools(),
            ...listCollectionTools(),
            ...listFileTools(),
            ...listMigrationTools(), // Uncommented
            ...listLogTools(), // Add log tools
            ...listCronTools(), // Add cron tools
        ];
        return { tools };
    }
  • Routing logic in handleToolCall that directs 'fetch_record' calls to the record tools handler.
    if (name === 'fetch_record' || name === 'list_records' || name === 'create_record' || name === 'update_record') {
        return handleRecordToolCall(name, toolArgs, pb);
    } else if (name === 'get_collection_schema' || name === 'list_collections') {
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. It states the tool fetches a record but does not mention error handling (e.g., what happens if the ID doesn't exist), authentication needs, rate limits, or return format. This leaves significant gaps for a read 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 wasted words. It is appropriately sized and front-loaded, directly stating the tool's purpose without unnecessary elaboration.

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 lack of annotations and output schema, the description is incomplete. It does not explain what the tool returns (e.g., record data, error responses) or address behavioral aspects like permissions or failure modes, which are crucial for a fetch operation in a database context.

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?

The input schema has 100% description coverage, clearly documenting both parameters ('collection' and 'id') with their types and requirements. The description adds no additional semantic context beyond what the schema provides, so it meets the baseline for high schema 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 action ('Fetch') and resource ('a single record from a PocketBase collection by ID'), making the purpose unambiguous. However, it does not explicitly differentiate from sibling tools like 'list_records' or 'get_collection_schema', which reduces it from a perfect score.

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 'list_records' for multiple records or 'get_collection_schema' for metadata. It lacks explicit when/when-not instructions or prerequisites, leaving usage context implied at best.

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

Related 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/mabeldata/pocketbase-mcp'

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