Skip to main content
Glama
muleiwu

DWZ Short URL MCP Server

by muleiwu

list_short_urls

Retrieve and filter your short URL inventory with pagination, domain-specific searches, and keyword lookups to manage links effectively.

Instructions

列出用户的短网址列表,支持分页、域名筛选和关键词搜索。

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
pageNo页码,从1开始
page_sizeNo每页数量,最大100,默认10
domainNo按域名筛选(可选)
keywordNo搜索关键词,搜索URL、标题或描述(可选)

Implementation Reference

  • The handler function for the 'list_short_urls' MCP tool. It logs the call, invokes the short link service to fetch the list, formats the pagination response, and returns structured data.
    handler: async function (args) {
      logger.info('MCP工具调用: list_short_urls', { args });
    
      return ErrorHandler.asyncWrapper(async () => {
        // 调用服务层获取短链接列表
        const result = await defaultShortLinkService.listShortUrls(args);
    
        // 格式化返回结果
        return {
          success: true,
          message: '获取短网址列表成功',
          data: {
            list: result.list || [],
            pagination: {
              total: result.total,
              page: result.page,
              size: result.size,
              total_pages: Math.ceil(result.total / result.size),
            },
          },
          meta: {
            operation: 'list_short_urls',
            timestamp: new Date().toISOString(),
            filters: {
              domain: args.domain || null,
              keyword: args.keyword || null,
            },
          },
        };
      })();
    },
  • Input schema definition for the 'list_short_urls' tool, specifying properties for pagination (page, page_size), filtering (domain, keyword) with types, descriptions, constraints, and examples.
    inputSchema: {
      type: 'object',
      properties: {
        page: {
          type: 'integer',
          description: '页码,从1开始',
          minimum: 1,
          default: 1,
          examples: [1, 2, 3],
        },
        page_size: {
          type: 'integer',
          description: '每页数量,最大100,默认10',
          minimum: 1,
          maximum: 100,
          default: 10,
          examples: [10, 20, 50],
        },
        domain: {
          type: 'string',
          description: '按域名筛选(可选)',
          pattern: '^[a-zA-Z0-9.-]+\\.[a-zA-Z]{2,}$',
          examples: ['short.ly'],
        },
        keyword: {
          type: 'string',
          description: '搜索关键词,搜索URL、标题或描述(可选)',
          maxLength: 100,
          examples: ['产品', '活动', 'github.com'],
        },
      },
      required: [],
    },
  • Registration of all MCP tools including 'list_short_urls' (via listShortUrlsTool) into the 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 validates parameters, normalizes pagination, constructs query params, calls the remote API to list short URLs, handles response, and manages errors.
    async listShortUrls(params = {}) {
      try {
        // 验证参数
        const validatedParams = validateOrThrow('listShortUrls', params);
    
        // 标准化分页参数
        const paginationParams = normalizePaginationParams(validatedParams);
    
        logger.info('列出短链接:', paginationParams);
    
        // 构建查询参数
        const queryParams = {
          page: paginationParams.page,
          page_size: paginationParams.page_size,
        };
    
        // 添加可选参数
        if (validatedParams.domain) {
          queryParams.domain = validatedParams.domain;
        }
        if (validatedParams.keyword) {
          queryParams.keyword = validatedParams.keyword;
        }
    
        // 发送请求
        const response = await this.httpClient.get(
          getApiUrl('/short_links'),
          queryParams
        );
    
        // 处理响应
        const result = this.handleApiResponse(response, '列出短链接');
    
        logger.info('获取短链接列表成功:', {
          total: result.total,
          page: result.page,
          size: result.size,
          count: result.list?.length || 0,
        });
    
        return result;
    
      } catch (error) {
        logger.error('列出短链接失败:', error);
        const handledError = ErrorHandler.handle(error);
        throw ErrorHandler.createMcpErrorResponse(handledError, error);
      }
    }
  • Joi validation schema used by the service layer for 'listShortUrls' parameters, referencing common rules for page, page_size, domain, and keyword.
    listShortUrls: Joi.object({
      page: commonRules.page,
      page_size: commonRules.pageSize,
      domain: commonRules.domain,
      keyword: commonRules.keyword,
    }),
Behavior2/5

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

With no annotations provided, the description carries full burden for behavioral disclosure. While it mentions pagination support, it doesn't describe important behavioral aspects like authentication requirements, rate limits, error conditions, or what the response format looks like (since there's no output schema). For a listing tool with filtering capabilities, this leaves significant gaps in understanding how the tool actually behaves.

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 Chinese sentence that front-loads the core purpose ('列出用户的短网址列表') followed by the key capabilities ('支持分页、域名筛选和关键词搜索'). Every word earns its place with zero wasted text, making it immediately scannable and understandable.

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?

For a tool with 4 parameters, no annotations, and no output schema, the description is insufficiently complete. While it states what the tool does at a high level, it doesn't provide enough context about authentication requirements, response format, error handling, or practical usage examples. The agent would need to guess about important operational aspects of this listing tool.

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?

Schema description coverage is 100%, so the schema already fully documents all 4 parameters with descriptions, constraints, and examples. The description mentions the three filtering parameters (pagination, domain filtering, keyword search) but adds no additional semantic information beyond what's in the schema. This meets the baseline of 3 for high schema coverage situations.

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 verb ('列出' - list) and resource ('用户的短网址列表' - user's short URL list), making the purpose immediately understandable. It distinguishes from siblings like 'get_url_info' (which likely gets details of a specific URL) by focusing on listing multiple items with filtering. However, it doesn't explicitly mention how it differs from 'list_domains' (which lists domains rather than URLs).

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description implies usage context through the mention of filtering capabilities (domain filtering and keyword search), suggesting this tool should be used when needing filtered lists rather than all URLs. However, it doesn't explicitly state when to use this versus alternatives like 'get_url_info' for single URL details or 'list_domains' for domain management. No explicit 'when-not' guidance is provided.

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