Skip to main content
Glama
zalab-inc
by zalab-inc

get_profile

Retrieve the current user's profile information from Linear to access personal details and account settings within the project management platform.

Instructions

A tool that gets the current user's profile from Linear

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The main handler function for the get_profile tool. It fetches the current user's profile from Linear using linearClient.viewer, processes it into a UserProfile object, formats it into human-readable text, and returns it as MCP content. Includes error handling.
    handler: async () => {
      try {
        // Get user profile data
        const profile = await linearClient.viewer;
        
        if (!profile) {
          return {
            content: [{
              type: "text",
              text: "Unable to retrieve user profile. Please check your connection to Linear.",
            }],
          };
        }
        
        // Convert to UserProfile format for safe processing
        const userProfile: UserProfile = {
          id: profile.id || "unknown-id",
          name: profile.name || "No Name",
          displayName: profile.displayName,
          email: profile.email,
          active: profile.active,
          admin: profile.admin,
          guest: profile.guest,
          createdAt: profile.createdAt,
          updatedAt: profile.updatedAt,
          lastSeen: profile.lastSeen,
          timezone: profile.timezone,
          createdIssueCount: profile.createdIssueCount,
          avatarBackgroundColor: profile.avatarBackgroundColor,
          url: profile.url,
          isMe: profile.isMe
        };
        
        // Format profile to human-readable text
        const formattedText = formatProfileToHumanReadable(userProfile);
        
        // Return formatted text
        return {
          content: [{
            type: "text",
            text: formattedText,
          }],
        };
      } catch (error) {
        // Handle errors gracefully
        const errorMessage = error instanceof Error ? error.message : "Unknown error";
        return {
          content: [{
            type: "text",
            text: `An error occurred while retrieving profile data:\n${errorMessage}`,
          }],
        };
      }
    }
  • TypeScript interface defining the structure of the user profile data used within the tool handler.
    interface UserProfile {
      id: string;
      name: string;
      displayName?: string;
      email?: string;
      active?: boolean;
      admin?: boolean;
      guest?: boolean;
      createdAt?: string | Date;
      updatedAt?: string | Date;
      lastSeen?: string | Date;
      timezone?: string;
      createdIssueCount?: number;
      avatarBackgroundColor?: string;
      url?: string;
      isMe?: boolean;
    }
  • src/index.ts:31-41 (registration)
    The get_profile tool (LinearGetProfileTool) is registered to the MCP server using registerTool, alongside other Linear tools.
    registerTool(server, [
      LinearSearchIssuesTool,
      LinearGetProfileTool,
      LinearCreateIssueTool,
      LinearCreateCommentTool,
      LinearUpdateCommentTool,
      LinearGetIssueTool,
      LinearGetTeamIdTool,
      LinearUpdateIssueTool,
      LinearGetCommentTool,
    ]);
  • Helper function that converts UserProfile data into a formatted, human-readable multi-line string.
    function formatProfileToHumanReadable(profile: UserProfile): string {
      if (!profile || !profile.id) {
        return "Invalid or incomplete profile data";
      }
    
      let result = `User ID: ${profile.id}\n`;
      result += `Name: ${safeText(profile.name)}\n`;
      
      if (profile.displayName) {
        result += `Display name: ${safeText(profile.displayName)}\n`;
      }
      
      if (profile.email) {
        result += `Email: ${safeText(profile.email)}\n`;
      }
      
      result += `Status: ${profile.active ? "Active" : "Inactive"}\n`;
      result += `Admin: ${profile.admin ? "Yes" : "No"}\n`;
      result += `Guest: ${profile.guest ? "Yes" : "No"}\n`;
      
      if (profile.createdAt) {
        result += `Created at: ${formatDate(profile.createdAt)}\n`;
      }
      
      if (profile.lastSeen) {
        result += `Last seen: ${formatDate(profile.lastSeen)}\n`;
      }
      
      if (profile.timezone) {
        result += `Timezone: ${safeText(profile.timezone)}\n`;
      }
      
      if (profile.createdIssueCount !== undefined) {
        result += `Issues created: ${profile.createdIssueCount}\n`;
      }
      
      if (profile.url) {
        result += `URL: ${safeText(profile.url)}\n`;
      }
      
      return result;
    }

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/zalab-inc/mcp-linear-app'

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