get_user_info
Retrieve Bilibili user details by providing a user ID (mid) to access profile information through the Bilibili-Api server.
Instructions
Get information about a Bilibili user
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| mid | Yes |
Implementation Reference
- src/mcp.ts:39-48 (handler)Shared handler function for all dynamically registered tools, including "get_user_info". It receives arguments and toolName, merges them, and delegates to the API proxy helper. Note: Has a misleading error message referencing 'aid' instead of toolName.const handleXiaoBenYangApi = async (args: Record<string, any>, toolName: string) => { // 校验aid是否存在 if (toolName === undefined || toolName === null) { throw new Error("缺少必要参数 'aid'"); } // 合并参数 const fullArgs = {...args, toolName: toolName}; // 调用API return calcXiaoBenYangApi(fullArgs); };
- src/mcp.ts:92-126 (schema)Dynamically constructs Zod input schema for each tool based on remote JSON schema description (parsed at line 91). Maps JSON types to Zod types and handles required/optional fields. Used for all tools including "get_user_info".const zodDict: Record<string, z.ZodTypeAny> = {}; Object.entries(inputSchema.properties).forEach(([name, propConfig]) => { let zodType; let pt = (propConfig as { type: string }).type; switch (pt) { case 'string': zodType = z.string(); break; case 'number': zodType = z.number(); break; case 'boolean': zodType = z.boolean(); break; case 'integer': zodType = z.int32(); break; case 'array': zodType = z.array(z.any()); break; case 'object': zodType = z.object(z.any()); break; default: zodType = z.any(); } if (inputSchema.required?.includes(name)) { zodDict[name] = zodType; } else { zodDict[name] = zodType.optional(); } });
- src/mcp.ts:50-65 (registration)Registers a tool on the MCP server with given name (e.g., "get_user_info"), description, Zod inputSchema, and a closure over the shared handler passing the tool name. Called dynamically for each remote tool description.const addToolXiaoBenYangApi = function ( name: string, desc: string, params: Record<string, ZodType> ) { server.registerTool( name, { title: name, description: desc, inputSchema: params, } , async (args: Record<string, any>) => handleXiaoBenYangApi(args, name) ) };
- src/mcp.ts:15-36 (helper)Core helper that proxies the tool execution to the remote service at https://mcp.xiaobenyang.com/api, sending toolName as 'func', API key, MCP ID, and arguments as form data. Formats response as MCP content block.const calcXiaoBenYangApi = async function (fullArgs: Record<string, any>) { // 发起 POST 请求 let response = await fetch('https://mcp.xiaobenyang.com/api', { method: 'POST', headers: { 'XBY-APIKEY': apiKey, 'func': fullArgs.toolName, 'mcpid': mcpID }, body: new URLSearchParams(fullArgs) }); const apiResult = await response.text(); return { content: [ { type: "text", text: apiResult // 将字符串结果放入 content 中 } ] } as { [x: string]: unknown; content: [{ type: "text"; text: string }] }; };