Skip to main content
Glama
user.ts948 B
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js" import { z } from "zod" import { formatUserInfo, getUserInfo } from "../common/utils.js" export function registerUserTools(server: McpServer): void { server.tool( "get_user_info", "Get information about a Bilibili user", { mid: z.number().int().positive().describe("User's numeric ID"), }, async ({ mid }) => { try { const userInfo = await getUserInfo(mid) || {} const formattedInfo = formatUserInfo(userInfo) return { content: [ { type: "text", text: formattedInfo, }, ], } } catch (error) { return { content: [ { type: "text", text: `get user info failed: ${error instanceof Error ? error.message : String(error)}`, }, ], } } } ) }

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/wangshunnn/bilibili-mcp-server'

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