Skip to main content
Glama
magarcia

Linear MCP Server

linear_get_team

Retrieve detailed information about a specific team in Linear's issue tracking system by providing the team ID.

Instructions

Get details about a specific team

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
teamIdYesTeam ID to get details for

Implementation Reference

  • The main ToolHandler function that fetches a specific Linear team by teamId, retrieves its states and members, and returns formatted JSON data or error.
    export const linearGetTeamHandler: ToolHandler = async args => {
      const params = args as {
        teamId: string;
      };
    
      try {
        // Validate required parameters
        if (!params.teamId) {
          return {
            content: [
              {
                type: 'text',
                text: 'Error: Team ID is required',
              },
            ],
            isError: true,
          };
        }
    
        // Get the team
        const team = await linearClient.team(params.teamId);
        if (!team) {
          return {
            content: [
              {
                type: 'text',
                text: `Error: Team with ID ${params.teamId} not found`,
              },
            ],
            isError: true,
          };
        }
    
        // Fetch team states (workflow)
        const states = await team.states();
    
        // Get team members
        const members = await team.members();
    
        // Extract team data
        const teamData = {
          id: await team.id,
          name: await team.name,
          key: await team.key,
          description: await team.description,
          color: await team.color,
          icon: await team.icon,
          private: await team.private,
          states:
            states && states.nodes
              ? await Promise.all(
                  states.nodes.map(async state => ({
                    id: await state.id,
                    name: await state.name,
                    color: await state.color,
                    type: await state.type,
                    position: await state.position,
                  }))
                )
              : [],
          members:
            members && members.nodes
              ? await Promise.all(
                  members.nodes.map(async member => {
                    try {
                      // Fetch the user directly using the memberId
                      const userId = await member.id;
                      if (userId) {
                        const user = await linearClient.user(userId);
                        return user
                          ? {
                              id: await user.id,
                              name: await user.name,
                              displayName: await user.displayName,
                              email: await user.email,
                            }
                          : null;
                      }
                      return null;
                    } catch (error) {
                      console.error('Error fetching team member:', error);
                      return null;
                    }
                  })
                ).then(results => results.filter(Boolean))
              : [],
          createdAt: await team.createdAt,
          updatedAt: await team.updatedAt,
        };
    
        return {
          content: [
            {
              type: 'text',
              text: JSON.stringify(teamData),
            },
          ],
        };
      } catch (error) {
        const errorMessage =
          error instanceof Error
            ? error.message
            : typeof error === 'string'
              ? error
              : 'Unknown error occurred';
    
        return {
          content: [
            {
              type: 'text',
              text: `Error: ${errorMessage}`,
            },
          ],
          isError: true,
        };
      }
    };
  • Registers the 'linear_get_team' tool using registerTool, linking the handler and defining input schema.
    export const linearGetTeamTool = registerTool(
      {
        name: 'linear_get_team',
        description: 'Get details about a specific team',
        inputSchema: {
          type: 'object',
          properties: {
            teamId: {
              type: 'string',
              description: 'Team ID to get details for',
            },
          },
          required: ['teamId'],
        },
      },
      linearGetTeamHandler
    );
  • Input schema defining the required 'teamId' parameter for the tool.
    inputSchema: {
      type: 'object',
      properties: {
        teamId: {
          type: 'string',
          description: 'Team ID to get details for',
        },
      },
      required: ['teamId'],
    },

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/magarcia/mcp-server-linearapp'

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