get-user
Retrieve detailed user information from note.com by providing a username to access profile data and membership details.
Instructions
ユーザーの詳細情報を取得する
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| username | Yes | ユーザー名(例: princess_11) |
Implementation Reference
- src/tools/user-tools.ts:19-35 (handler)The inline async handler function for the 'get-user' tool. It fetches user details from the Note API using noteApiRequest, formats the response with formatUser, and 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)Input schema for the 'get-user' tool using Zod: requires 'username' as string.{ username: z.string().describe("ユーザー名(例: princess_11)"), },
- src/tools/user-tools.ts:13-36 (registration)Primary registration of the 'get-user' tool via server.tool() call within registerUserTools function, including name, description, schema, and handler.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/utils/formatters.ts:116-129 (helper)Supporting formatUser utility function that standardizes the raw user data from API into a formatted response object used by the get-user handler.export function formatUser(user: NoteUser): FormattedUser { return { id: user.id || "", nickname: user.nickname || "", urlname: user.urlname || "", bio: user.profile?.bio || user.bio || '', followersCount: user.followerCount || user.followersCount || 0, followingCount: user.followingCount || 0, notesCount: user.noteCount || user.notesCount || 0, magazinesCount: user.magazineCount || user.magazinesCount || 0, url: `https://note.com/${user.urlname || ''}`, profileImageUrl: user.profileImageUrl || '' }; }
- src/tools/index.ts:19-19 (registration)Intermediate registration step: calls registerUserTools(server) from within the registerAllTools aggregator function.registerUserTools(server);