Skip to main content
Glama
mabeldata

PocketBase MCP Server

by mabeldata

fetch_record

Retrieve a single record from a PocketBase collection by providing the collection name or ID and the record ID.

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 actual handler function for the 'fetch_record' tool. It validates arguments (collection, id), calls PocketBase's getOne to fetch the record, and returns the result as formatted JSON.
    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 for FetchRecordArgs, defining the input schema with 'collection' (string) and 'id' (string) fields.
    export interface FetchRecordArgs {
      collection: string;
      id: string;
    }
  • Registers the 'fetch_record' tool with its name, description, and input schema (collection and id as required strings).
    const recordToolInfo: ToolInfo[] = [
        {
            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'],
            },
        },
  • Main routing logic that dispatches 'fetch_record' to handleRecordToolCall in record-tools.ts.
    if (name === 'fetch_record' || name === 'list_records' || name === 'create_record' || name === 'update_record') {
        return handleRecordToolCall(name, toolArgs, pb);
  • Dispatch within record-tools.ts that routes the 'fetch_record' case to the fetchRecord function.
    case 'fetch_record':
        return fetchRecord(args as FetchRecordArgs, pb);
Behavior2/5

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

No annotations are present, so the description must fully disclose behavior. It only states the basic action without mentioning authentication requirements, rate limits, return format, or error handling. Critical information is missing for a safe and informed invocation.

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, direct sentence with no extraneous words. It is optimally concise and front-loaded with the essential information.

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?

Despite its simplicity, the tool operates in a context with many sibling tools and no output schema. The description fails to specify the return structure (e.g., full record object, fields), handling of missing IDs, or any prerequisites. For a basic CRUD tool, more context is needed for reliable use.

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, with clear descriptions for 'collection' and 'id'. The description adds no further detail, but the schema itself is sufficient. Baseline score of 3 is appropriate since the description does not need to compensate.

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 explicitly states 'Fetch a single record from a PocketBase collection by ID,' with a specific verb ('Fetch'), resource ('single record'), and method ('by ID'). It clearly distinguishes from sibling tools like list_records (which fetches multiple records with filters).

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 like list_records, update_record, or create_record. The agent is left to infer the appropriate context without explicit direction.

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

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