Skip to main content
Glama
kesslerio

YOURLS-MCP

by kesslerio

url_stats

Retrieve detailed click statistics and analytics for any shortened URL using the YOURLS-MCP server. Input the short URL or keyword to generate insights into link performance and usage patterns.

Instructions

Get statistics for a shortened URL

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
shorturlYesThe short URL or keyword to get stats for

Implementation Reference

  • The execute function that implements the core logic of the 'url_stats' MCP tool. It calls yourlsClient.urlStats(shorturl), processes the result, and returns a standardized MCP response using createMcpResponse.
    execute: async ({ shorturl }) => {
      try {
        const result = await yourlsClient.urlStats(shorturl);
        
        if (result.link) {
          return createMcpResponse(true, {
            shorturl: result.shorturl || shorturl,
            clicks: result.link.clicks || 0,
            title: result.link.title || '',
            longurl: result.link.url || ''
          });
        } else {
          return createMcpResponse(false, {
            message: result.message || 'Unknown error',
            code: result.code || 'unknown'
          });
        }
      } catch (error) {
        return createMcpResponse(false, {
          message: error.message
        });
      }
    }
  • JSON Schema definition for the input parameters of the 'url_stats' tool, specifying that 'shorturl' is a required string.
    inputSchema: {
      type: 'object',
      properties: {
        shorturl: {
          type: 'string',
          description: 'The short URL or keyword to get stats for'
        }
      },
      required: ['shorturl']
    },
  • src/index.js:153-159 (registration)
    Registers the 'url_stats' tool with the MCP server using server.tool(), providing the name, description, Zod input schema validation, and the execute handler reference.
      urlStatsTool.name,
      urlStatsTool.description,
      {
        shorturl: z.string().describe('The short URL or keyword to get stats for')
      },
      urlStatsTool.execute
    );
  • The YourlsClient.urlStats method, a supporting utility that makes the underlying 'url-stats' API request to the YOURLS server, used by the tool handler.
    async urlStats(shorturl) {
      return this.request('url-stats', { shorturl });
    }
  • Alternative registration of the 'url_stats' tool in the tools index module (potentially unused), dynamically generating Zod schema from inputSchema.
    server.tool(
      urlStatsTool.name,
      urlStatsTool.description,
      {
        shorturl: urlStatsTool.inputSchema.properties.shorturl.description ? 
                 z.string().describe(urlStatsTool.inputSchema.properties.shorturl.description) : 
                 z.string()
      },
      urlStatsTool.execute
    );
Behavior2/5

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

No annotations are provided, so the description carries the full burden of behavioral disclosure. It states the action ('Get statistics') but fails to describe key traits like what statistics are returned, whether authentication is required, rate limits, or error handling. This leaves significant gaps for a tool that likely involves data retrieval.

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 directly states the tool's purpose without unnecessary words. It is front-loaded and appropriately sized, making it easy for an agent to parse quickly and understand the core functionality.

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 the lack of annotations and output schema, the description is incomplete for a tool that retrieves statistics. It doesn't specify what statistics are included, the format of the response, or any behavioral nuances, leaving the agent with insufficient context to use the tool effectively beyond basic invocation.

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, clearly documenting the 'shorturl' parameter. The description adds no additional meaning beyond this, as it doesn't elaborate on parameter syntax, examples, or constraints. With high schema coverage, the baseline score of 3 is appropriate, as the schema handles the heavy lifting.

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's purpose with a specific verb ('Get') and resource ('statistics for a shortened URL'), making it immediately understandable. However, it doesn't differentiate from sibling tools like 'url_analytics' or 'shorten_with_analytics', which might offer similar statistical functionality, preventing a perfect score.

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 sibling tools like 'url_analytics', 'db_stats', and 'shorten_with_analytics' potentially overlapping in functionality, the agent lacks explicit direction on selection criteria, such as specific use cases or data scope differences.

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