Skip to main content
Glama

实时数据/虎扑步行街热榜A

Access trending topics and popular discussions from Hupu's Walking Street community to stay informed about current conversations and community interests.

Instructions

实时数据/虎扑步行街热榜A

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • Shared handler function that implements the core logic for all dynamically loaded tools, including "实时数据/虎扑步行街热榜A". It sends a POST request to the xiaobenyang.com API endpoint with the tool's specific aid and parameters.
    const calcXiaoBenYangApi = async function (fullArgs) {
        // 发起 GET 请求
        let response = await fetch('https://xiaobenyang.com/api', {
            method: 'POST',
            headers: {
                'APIKEY': process.env.API_KEY,
                'aid': fullArgs.aid
            },
            body: new URLSearchParams(fullArgs)
        });
        return await response.text();
    }
  • Loop that registers each tool from the fetched API list. The tool name "实时数据/虎扑步行街热榜A" comes from apiDesc.title, registered with its specific apiId as aid in the handler.
    for (const apiDesc of apiDescList) {
        addToolXiaoBenYangApi(apiDesc.apiId.toString(),
            apiDesc.title,
            apiDesc.description ? apiDesc.description : apiDesc.title,
            convertParamsToZ(apiDesc.params));
    }
  • Helper function to add each tool to the MCP server, setting name from API title, parameters from converted schema, and execute handler with tool-specific aid.
    const addToolXiaoBenYangApi = function (aid, title, desc, params) {
        server.addTool({
            name: title,
            description: desc,
            parameters: params,
            execute: async (args) => {
                // 合并用户输入 args 和工具专属 aid
                const fullArgs = {...args, aid: aid};
                return calcXiaoBenYangApi(fullArgs);
            }
        });
    }
  • Converts Java parameter descriptions from the API into Zod schemas for tool input validation. Used for all tools including the target.
    const convertParamsToZ = function (params) {
        let zParams = {};
        for (const param of params) {
            let zodType = convertJavaTypeToZod(param.type)
            if (param.description) {
                zodType = zodType.describe(param.name);
            }
            if (param.required) {
                zodType = zodType.optional();
            }
    
            zParams[param.name] = zodType;
        }
        return z.object(zParams);
    }
  • Java type to Zod schema conversion utilities, including parseGenericType and convertJavaTypeToZod functions, used to generate tool schemas from API metadata.
    const JAVA_TO_ZOD_MAP = {
        // 基础类型(全类名)
        'java.lang.String': () => z.string(),
        'java.lang.Integer': () => z.number().int(),
        'java.lang.Long': () => z.number().int(),
        'java.lang.Float': () => z.number(),
        'java.lang.Double': () => z.number(),
        'java.lang.Boolean': () => z.boolean(),
        'java.time.LocalDate': () => z.string().regex(/^\d{4}-\d{2}-\d{2}$/), // 简单日期验证
        'java.time.LocalDateTime': () => z.string().regex(/^\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}$/), // 简单时间验证
    
        // 集合类型(全类名)
        'java.util.List': (genericType) => z.array(convertJavaTypeToZod(genericType)), // 泛型参数递归转换
        'java.util.Set': (genericType) => z.array(convertJavaTypeToZod(genericType)).unique(), // Set 对应去重数组
        'java.util.Map': (keyType, valueType) => z.record(convertJavaTypeToZod(keyType), convertJavaTypeToZod(valueType)), // Map 对应 record
    
        // 简单类名映射(防止全类名解析失败时 fallback)
        String: () => z.string(),
        Integer: () => z.number().int(),
        Long: () => z.number().int(),
        Float: () => z.number(),
        Double: () => z.number(),
        Boolean: () => z.boolean(),
        List: (genericType) => z.array(convertJavaTypeToZod(genericType)),
    };
    
    /**
     * 解析 Java 泛型类型(如 "List<String>" → { base: "List", generics: ["String"] })
     * @param {string} javaType Java 类型字符串(可能含泛型)
     * @returns {object} 解析结果 { base: 基础类型, generics: 泛型参数数组 }
     */
    function parseGenericType(javaType) {
        const angleBracketIndex = javaType.indexOf('<');
        if (angleBracketIndex === -1) {
            return {base: javaType.trim(), generics: []};
        }
    
        // 提取基础类型(如 "List<String>" → "List")
        const baseType = javaType.slice(0, angleBracketIndex).trim();
        // 提取泛型参数(如 "List<String>" → "String")
        const genericsStr = javaType.slice(angleBracketIndex + 1, javaType.lastIndexOf('>')).trim();
    
        // 处理嵌套泛型(如 "Map<String, List<Integer>>")
        const generics = [];
        let balance = 0; // 用于处理嵌套 <> 的平衡
        let current = '';
        for (const char of genericsStr) {
            if (char === '<') balance++;
            if (char === '>') balance--;
            if (char === ',' && balance === 0) {
                generics.push(current.trim());
                current = '';
            } else {
                current += char;
            }
        }
        if (current) generics.push(current.trim());
    
        return {base: baseType, generics};
    }
    
    /**
     * 将 Java 类型名称转换为 Zod 类型
     * @param {string} javaType Java 类型全名(如 "java.lang.String"、"java.util.List<java.lang.Integer>")
     * @returns {z.ZodType} Zod 类型对象
     */
    function convertJavaTypeToZod(javaType) {
        // 解析泛型(如处理 "List<Integer>" 这种格式)
        const {base: baseType, generics} = parseGenericType(javaType);
    
        // 优先匹配全类名(如 "java.lang.String")
        if (JAVA_TO_ZOD_MAP[baseType]) {
            return JAVA_TO_ZOD_MAP[baseType](...generics);
        }
    
        // 若全类名未匹配,提取简单类名再匹配(如 "String" 从 "java.lang.String" 提取)
        const simpleTypeName = baseType.split('.').pop();
        if (JAVA_TO_ZOD_MAP[simpleTypeName]) {
            return JAVA_TO_ZOD_MAP[simpleTypeName](...generics);
        }
    
        // 未匹配的类型默认视为自定义对象(返回 z.object(),需手动补充)
        return z.object({});
    }
Behavior1/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. The description reveals nothing about what the tool actually does behaviorally—whether it fetches data, subscribes to updates, requires authentication, has rate limits, returns structured data, or has any side effects. It's completely inadequate for understanding the tool's operation.

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

Conciseness2/5

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

While the description is extremely concise (just the tool name repeated), this is under-specification rather than effective conciseness. It doesn't front-load essential information about the tool's purpose or behavior. The single phrase doesn't earn its place by adding value beyond the name itself, making it inefficient for helping an AI agent understand the tool.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness1/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the complexity implied by real-time data fetching (typically involving network calls, potential authentication, and dynamic outputs) and the absence of both annotations and an output schema, the description is severely incomplete. It fails to explain what the tool returns, how it behaves, or any operational constraints, leaving critical gaps for an AI agent to use it correctly.

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 (schema coverage is 100% with an empty object), so there are no parameters to document. The description doesn't need to compensate for any parameter gaps. A baseline score of 4 is appropriate since the schema fully covers the parameter situation (none exist), and the description doesn't contradict or add unnecessary information about parameters.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose2/5

Does the description clearly state what the tool does and how it differs from similar tools?

Tautological: description restates name/title.

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

Usage Guidelines1/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 any specific context, prerequisites, or differences from sibling tools like '实时数据/虎扑步行街热榜' (which appears to be a similar tool without the 'A' suffix). There's no indication of when this tool is appropriate or when other tools should be used instead.

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/xiaobenyang-com/mcp-tools'

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