Skip to main content
Glama

get_logs_stats

Analyze API request logs by retrieving statistics, with optional filtering to focus on specific criteria like methods or endpoints, for effective monitoring and debugging.

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 execution logic for the 'get_logs_stats' tool. It extracts the optional filter from args, calls pb.logs.getStats(), formats the result as JSON, and handles errors appropriately.
    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; } }
  • JSON schema definition for input validation of the 'get_logs_stats' tool, specifying an optional 'filter' string property.
    inputSchema: { type: 'object', properties: { filter: { type: 'string', description: 'PocketBase filter string (e.g., "method=\'GET\'").' }, }, required: [], },
  • ToolInfo registration for 'get_logs_stats' including name, description, and inputSchema, part of logToolInfo array returned by listLogTools().
    { 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: [], }, }, ];
  • TypeScript interface defining the input arguments for the 'get_logs_stats' tool.
    export interface GetLogsStatsArgs { filter?: string; }
  • Routing logic in central handleToolCall that directs 'get_logs_stats' calls to the log-tools handler.
    } else if (name === 'list_logs' || name === 'get_log' || name === 'get_logs_stats') { return handleLogToolCall(name, toolArgs, pb);

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