Skip to main content
Glama
mabeldata

PocketBase MCP Server

by mabeldata

get_logs_stats

Retrieve aggregated statistics of API request logs from PocketBase, with optional filtering by fields such as method or status.

Instructions

Get API request logs statistics with optional filtering.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
filterNoPocketBase filter string (e.g., "method='GET'").

Implementation Reference

  • The main handler function for 'get_logs_stats'. It accepts a 'filter' parameter, calls PocketBase's logs.getStats() API, and returns the result as JSON text. Includes error handling for API failures.
    async function getLogsStats(args: GetLogsStatsArgs, pb: PocketBase): Promise<ToolResult> {
        const { filter } = args;
        
        try {
            // Make the API request to get logs statistics
            const result = await pb.logs.getStats({ 
                filter
             });
            
            return {
                content: [{ type: 'text', text: JSON.stringify(result, null, 2) }],
            };
        } catch (error) {
            // If there's an error, return a more descriptive error
            if (error instanceof Error) {
                return {
                    content: [{ type: 'text', text: `Error fetching log stats: ${error.message}` }],
                    isError: true
                };
            }
            throw error;
        }
    }
  • TypeScript interface for the 'get_logs_stats' tool arguments. Defines an optional 'filter' string parameter.
    export interface GetLogsStatsArgs {
      filter?: string;
    }
  • Registers 'get_logs_stats' in the logToolInfo array with its name, description, and inputSchema (accepting an optional filter string).
    {
        name: 'get_logs_stats',
        description: 'Get API request logs statistics with optional filtering.',
        inputSchema: {
            type: 'object',
            properties: {
                filter: { type: 'string', description: 'PocketBase filter string (e.g., "method=\'GET\'").' },
            },
            required: [],
        },
    },
  • Routes the tool name 'get_logs_stats' to the handleLogToolCall function in log-tools.ts.
    } else if (name === 'list_logs' || name === 'get_log' || name === 'get_logs_stats') {
        return handleLogToolCall(name, toolArgs, pb);
  • Re-exports the GetLogsStatsArgs interface from tool-types.ts for use by other modules.
    ListLogsArgs,
    GetLogArgs,
    GetLogsStatsArgs,
Behavior3/5

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

The description implies a read-only operation with no side effects, but lacks explicit disclosure of behavior beyond annotations (which are absent). It does not mention auth requirements or rate limits, but is adequate for a simple stats tool.

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 sentence that front-loads the purpose. It is concise with no unnecessary words.

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

Completeness3/5

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

Given the simplicity of parameters and no output schema, the description is minimally complete. However, it does not specify what statistics are returned (e.g., counts, error rates), leaving ambiguity about the output.

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 schema covers 100% of parameters, so the description adds little value beyond stating 'optional filtering', which mirrors the schema. No additional semantic context is provided.

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 tool gets 'API request logs statistics' with optional filtering, distinguishing it from siblings that list or retrieve individual logs. However, it could be more explicit about the type of statistics (e.g., count, distribution).

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_logs or get_log. The description does not mention exclusions or specific contexts.

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