Skip to main content
Glama
muleiwu

DWZ Short URL MCP Server

by muleiwu

get_url_info

Retrieve detailed information about a short URL, including the original link, click statistics, and creation date, by providing its unique ID.

Instructions

根据短网址ID获取详细信息,包括原始URL、点击统计、创建时间等。

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
idYes短网址的唯一标识ID

Implementation Reference

  • Primary MCP tool implementation for 'get_url_info', including the handler function that executes the tool logic by calling the short link service and formatting the response. Also includes the input schema definition.
    export const getUrlInfoTool = {
      name: 'get_url_info',
      description: '根据短网址ID获取详细信息,包括原始URL、点击统计、创建时间等。',
      inputSchema: {
        type: 'object',
        properties: {
          id: {
            type: 'integer',
            description: '短网址的唯一标识ID',
            minimum: 1,
            examples: [1, 123, 456],
          },
        },
        required: ['id'],
      },
    
      /**
       * 处理工具调用
       * @param {Object} args - 工具参数
       * @returns {Promise<Object>} 工具执行结果
       */
      handler: async function (args) {
        logger.info('MCP工具调用: get_url_info', { args });
    
        return ErrorHandler.asyncWrapper(async () => {
          // 调用服务层获取短链接信息
          const result = await defaultShortLinkService.getUrlInfo(args.id);
    
          // 格式化返回结果
          return {
            success: true,
            message: '获取短网址信息成功',
            data: {
              id: result.id,
              short_code: result.short_code,
              short_url: result.short_url,
              original_url: result.original_url,
              title: result.title,
              description: result.description,
              domain: result.domain,
              expire_at: result.expire_at,
              is_active: result.is_active,
              click_count: result.click_count,
              created_at: result.created_at,
              updated_at: result.updated_at,
            },
            meta: {
              operation: 'get_url_info',
              timestamp: new Date().toISOString(),
            },
          };
        })();
      },
    };
  • Registration of the getUrlInfoTool in the MCP server's tools map during server initialization.
    registerTools() {
      const tools = [
        createShortUrlTool,
        getUrlInfoTool,
        listShortUrlsTool,
        deleteShortUrlTool,
        batchCreateShortUrlsTool,
        listDomainsTool,
      ];
    
      for (const tool of tools) {
        this.tools.set(tool.name, tool);
        logger.debug(`注册工具: ${tool.name}`);
      }
    
      logger.info(`已注册 ${tools.length} 个工具`);
    }
  • Helper service method that performs the actual API call to retrieve short URL information by ID, including validation and error handling.
    async getUrlInfo(id) {
      try {
        // 验证参数
        validateOrThrow('getUrlInfo', { id });
    
        logger.info('获取短链接信息:', { id });
    
        // 发送请求
        const response = await this.httpClient.get(
          getApiUrl(`/short_links/${id}`)
        );
    
        // 处理响应
        const result = this.handleApiResponse(response, '获取短链接信息');
    
        logger.info('获取短链接信息成功:', {
          id: result.id,
          short_code: result.short_code,
          original_url: result.original_url,
        });
    
        return result;
    
      } catch (error) {
        logger.error('获取短链接信息失败:', error);
        const handledError = ErrorHandler.handle(error);
        throw ErrorHandler.createMcpErrorResponse(handledError, error);
      }
    }
  • Joi validation schema for 'getUrlInfo' input parameters used in the service layer.
    getUrlInfo: Joi.object({
      id: commonRules.id,
    }),
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. While it states this is a read operation ('获取'), it doesn't mention potential constraints like authentication requirements, rate limits, error conditions (e.g., invalid ID), or what happens if the ID doesn't exist. For a tool with no annotation coverage, this leaves significant gaps in understanding its behavior.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, efficient sentence that states the purpose and lists examples of returned information (original URL, click statistics, creation time). It's front-loaded with the core function and avoids unnecessary words. However, it could be slightly more structured by separating the purpose from the examples for clarity.

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 tool's simplicity (1 parameter, no output schema, no annotations), the description is minimally adequate. It covers the basic purpose and hints at return values, but lacks details on behavioral aspects like errors or constraints. Without annotations or output schema, the description should ideally provide more context on what '详细信息' entails and any usage limitations to be fully complete.

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 description coverage is 100%, with the single parameter 'id' well-documented in the schema as '短网址的唯一标识ID' (unique identifier ID for short URL). The description doesn't add any parameter-specific information beyond what's in the schema, such as format details or examples. With high schema coverage, the baseline score of 3 is appropriate as the schema handles the parameter documentation adequately.

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: '根据短网址ID获取详细信息' (get detailed information based on short URL ID). It specifies the verb '获取' (get/retrieve) and resource '详细信息' (detailed information), and lists examples of what information is included. However, it doesn't explicitly differentiate from sibling tools like 'list_short_urls' which might provide similar information in a different format.

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. It doesn't mention sibling tools like 'list_short_urls' (which might list multiple URLs without details) or 'batch_create_short_urls' (for creation). There's no context about prerequisites, such as needing an existing short URL ID, or when this tool is preferred over others.

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/muleiwu/dwz-mcp'

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