Skip to main content
Glama

db_stats

Retrieve global statistics for a YOURLS URL shortener instance, including click data and usage metrics, to monitor and analyze performance.

Instructions

Get global statistics for the YOURLS instance

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The createDbStatsTool factory function defines the MCP tool 'db_stats' including its name, description, input schema (empty), and the main execute handler that fetches database statistics from the YOURLS API via yourlsClient.dbStats() and formats the response using createMcpResponse.
    export default function createDbStatsTool(yourlsClient) { return { name: 'db_stats', description: 'Get global statistics for the YOURLS instance', inputSchema: { type: 'object', properties: {} }, execute: async () => { try { const result = await yourlsClient.dbStats(); if (result['db-stats']) { const stats = result['db-stats']; return createMcpResponse(true, { total_links: stats.total_links || 0, total_clicks: stats.total_clicks || 0 }); } else { return createMcpResponse(false, { message: result.message || 'Unknown error', code: result.code || 'unknown' }); } } catch (error) { return createMcpResponse(false, { message: error.message }); } } }; }
  • src/index.js:161-166 (registration)
    Registration of the db_stats tool with the MCP server using server.tool(), providing name, description, empty input schema ({}), and the execute handler.
    server.tool( dbStatsTool.name, dbStatsTool.description, {}, dbStatsTool.execute );
  • The underlying dbStats method in YourlsClient class that makes the 'db-stats' API request to the YOURLS server, called by the tool handler.
    async dbStats() { return this.request('db-stats', {}); }
  • Input schema definition for the db_stats tool: an empty object indicating no input parameters required.
    inputSchema: { type: 'object', properties: {}

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/kesslerio/yourls-mcp'

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