Skip to main content
Glama

get_team_id

Retrieve all teams and their corresponding IDs from Linear to enable accurate team-specific operations in project management workflows.

Instructions

A tool that gets all teams and their IDs from Linear

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The main handler implementation for the 'get_team_id' tool. It fetches teams using linearClient.teams(), processes the data, formats it using a helper function, and returns a text response with team IDs.
    export const LinearGetTeamIdTool = createSafeTool({ name: "get_team_id", description: "A tool that gets all teams and their IDs from Linear", schema: z.object({}).shape, handler: async () => { try { // Get teams from Linear const teamsResponse = await linearClient.teams(); if (!teamsResponse || !teamsResponse.nodes) { return { content: [{ type: "text", text: "Could not retrieve teams from Linear. Please check your connection or permissions.", }], }; } // Convert to TeamData format for safe processing const teams: TeamData[] = teamsResponse.nodes.map(team => ({ id: team.id || "unknown-id", name: team.name || "Unnamed Team", key: team.key || "unknown-key", description: team.description, color: team.color, createdAt: team.createdAt, updatedAt: team.updatedAt, issueCount: team.issueCount, private: team.private, // Generate a URL if not available directly from the API url: `https://linear.app/team/${team.key}` })); // Format teams to human-readable text const formattedText = formatTeamsToHumanReadable(teams); // 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 teams:\n${errorMessage}`, }], }; } } });
  • TypeScript interface defining the structure of team data used within the tool handler for type safety.
    interface TeamData { id: string; name: string; key: string; description?: string; color?: string; createdAt?: string | Date; updatedAt?: string | Date; issueCount?: number; private?: boolean; url?: string; }
  • Helper function that formats an array of TeamData objects into a human-readable string listing team IDs.
    function formatTeamsToHumanReadable(teams: TeamData[]): string { if (!teams || teams.length === 0) { return "No teams found in your Linear workspace."; } let result = ""; teams.forEach((team, index) => { if (index > 0) { result += "\n"; } result += `Team ID: ${team.id}`; }); return result; }
  • src/index.ts:31-41 (registration)
    Registers the LinearGetTeamIdTool (and other Linear tools) with the MCP server using the registerTool utility.
    registerTool(server, [ LinearSearchIssuesTool, LinearGetProfileTool, LinearCreateIssueTool, LinearCreateCommentTool, LinearUpdateCommentTool, LinearGetIssueTool, LinearGetTeamIdTool, LinearUpdateIssueTool, LinearGetCommentTool, ]);

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