get-github-user
Retrieve detailed GitHub user information by providing a username. This tool, part of the MCP-Server, integrates with external APIs to fetch and return user data for streamlined access and usage.
Instructions
根据用户名获取 Github 用户信息
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| username | No |
Implementation Reference
- src/index.ts:87-101 (handler)The asynchronous handler function for the 'get-github-user' tool. It takes a username, fetches user data from the GitHub API, and returns the data as a JSON string in the specified content format.async ({ username }) => { // 获取网格点数据的 URL const pointsUrl = `https://api.github.com/users/${username}`; const data: Root = await fetch(pointsUrl).then((response) => response.json(), ); return { content: [ { type: 'text', text: JSON.stringify(data), }, ], }; },
- src/index.ts:83-85 (schema)The input schema for the 'get-github-user' tool, defined using Zod. It specifies an optional 'username' parameter of type string.{ username: z.string().optional(), },
- src/index.ts:77-102 (registration)The registration of the 'get-github-user' tool using McpServer's tool method, including name, description, input schema, and handler function.server.tool( // 工具名称 'get-github-user', // 工具描述 '根据用户名获取 Github 用户信息', // 工具参数 { username: z.string().optional(), }, // 工具的异步处理函数 async ({ username }) => { // 获取网格点数据的 URL const pointsUrl = `https://api.github.com/users/${username}`; const data: Root = await fetch(pointsUrl).then((response) => response.json(), ); return { content: [ { type: 'text', text: JSON.stringify(data), }, ], }; }, );