Skip to main content
Glama

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
NameRequiredDescriptionDefault
usernameYesユーザー名(例: princess_11)

Implementation Reference

  • 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, "ユーザー情報取得");
      }
    }
  • Input schema for the 'get-user' tool using Zod: requires 'username' as string.
    {
      username: z.string().describe("ユーザー名(例: princess_11)"),
    },
  • 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, "ユーザー情報取得");
        }
      }
    );
  • 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 || ''
      };
    }
  • Intermediate registration step: calls registerUserTools(server) from within the registerAllTools aggregator function.
    registerUserTools(server);

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/shimayuz/note-com-mcp'

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