get-github-user
Retrieve GitHub user information by providing a username to access profile data through the MCP server.
Instructions
根据用户名获取 Github 用户信息
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| username | No |
Implementation Reference
- src/index.ts:87-101 (handler)Handler function that fetches GitHub user information from the GitHub API based on the provided username and returns it as a JSON string in text content.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:77-102 (registration)Registration of the 'get-github-user' tool using server.tool, specifying 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), }, ], }; }, );
- src/index.ts:83-85 (schema)Zod schema defining the input parameter 'username' as an optional string.{ username: z.string().optional(), },