get-user
Retrieve user profile information from note.com by providing a username to access account details and member data.
Instructions
ユーザーの詳細情報を取得する
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| username | Yes | ユーザー名(例: princess_11) |
Implementation Reference
- src/tools/user-tools.ts:19-35 (handler)Executes the core logic of the 'get-user' tool: fetches user data from Note.com API endpoint `/v2/creators/${username}`, formats it with formatUser helper, wraps in success response or handles errors.async ({ username }) => { try { const data = await noteApiRequest(`/v2/creators/${username}`); const userData = data.data || {}; if (env.DEBUG) { console.error(`User API Response: ${JSON.stringify(data, null, 2)}`); } const formattedUser = formatUser(userData); return createSuccessResponse(formattedUser); } catch (error) { return handleApiError(error, "ユーザー情報取得"); } }
- src/tools/user-tools.ts:16-18 (schema)Zod input schema defining the 'username' parameter as a required string for the get-user tool.{ username: z.string().describe("ユーザー名(例: princess_11)"), },
- src/tools/user-tools.ts:13-36 (registration)Registers the 'get-user' tool on the MCP server with name, description, input schema, and handler function.server.tool( "get-user", "ユーザーの詳細情報を取得する", { username: z.string().describe("ユーザー名(例: princess_11)"), }, async ({ username }) => { try { const data = await noteApiRequest(`/v2/creators/${username}`); const userData = data.data || {}; if (env.DEBUG) { console.error(`User API Response: ${JSON.stringify(data, null, 2)}`); } const formattedUser = formatUser(userData); return createSuccessResponse(formattedUser); } catch (error) { return handleApiError(error, "ユーザー情報取得"); } } );
- src/tools/index.ts:16-16 (registration)Top-level registration call within tools/index.ts that invokes registerUserTools to add the get-user tool to the server.registerUserTools(server);
- src/tools/user-tools.ts:4-4 (helper)Imports formatUser helper used in the get-user handler to process raw API response into formatted user data.import { formatUser, formatNote } from "../utils/formatters.js";