Skip to main content
Glama
kesslerio

YOURLS-MCP

by kesslerio

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: {}
Behavior2/5

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

No annotations are provided, so the description carries full burden for behavioral disclosure. While 'Get' implies a read operation, it doesn't specify whether this requires authentication, what format the statistics are returned in, whether there are rate limits, or if the data is cached. For a statistics tool with zero annotation coverage, this leaves significant gaps.

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 that gets straight to the point without any unnecessary words. It's perfectly front-loaded with the core functionality, making it easy for an AI agent to quickly understand what the tool does.

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 that this is a statistics tool with no annotations and no output schema, the description is insufficient. It doesn't explain what kind of statistics are returned (e.g., total URLs, clicks, users), the format of the response, or any behavioral characteristics. For a tool that presumably returns structured data, more context is needed.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The tool has zero parameters, and schema description coverage is 100%, so there are no parameters to document. The description appropriately doesn't waste space discussing nonexistent parameters, earning a baseline score of 4 for this dimension.

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 ('Get') and target resource ('global statistics for the YOURLS instance'), making the tool's purpose immediately understandable. However, it doesn't explicitly differentiate from sibling tools like 'url_stats' or 'url_analytics', which also provide statistical data but for different scopes.

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. With siblings like 'url_stats' and 'url_analytics' that also provide statistics, there's no indication whether this tool should be used for system-wide metrics versus URL-specific data, or any prerequisites for its use.

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

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