Skip to main content
Glama
keegancsmith

Linear Issues MCP Server

by keegancsmith

linear_get_issue

Fetch details of a Linear issue using its URL or identifier to access information and comments for project management.

Instructions

Fetch details of a single Linear issue by providing its URL or identifier.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
issueYesLinear issue URL or identifier (e.g., 'ENG-123' or 'https://linear.app/team/issue/ENG-123/issue-title')

Implementation Reference

  • The handler function for the 'linear_get_issue' tool. It extracts the 'issue' parameter and calls the shared fetchLinearIssue helper without comments.
    /**
     * Tool handler for linear_get_issue - Fetches a single Linear issue by URL or ID
     * @param {Object} params - Parameters from the tool call
     * @param {string} params.issue - Linear issue URL or ID
     * @returns {Object} - Response object with issue details or error
     */
    async function getLinearIssue({ issue }) {
      return fetchLinearIssue(issue, false);
    }
  • Zod input schema defining the 'issue' parameter (string: URL or ID) for the linear_get_issue tool.
    issue: z
      .string()
      .describe(
        "Linear issue URL or identifier (e.g., 'ENG-123' or 'https://linear.app/team/issue/ENG-123/issue-title')"
      ),
  • Registration of the 'linear_get_issue' tool on the MCP server, including name, description, schema, handler, and annotations.
    // Register the linear_get_issue tool
    server.tool(
      "linear_get_issue",
      "Fetch details of a single Linear issue by providing its URL or identifier.",
      {
        issue: z
          .string()
          .describe(
            "Linear issue URL or identifier (e.g., 'ENG-123' or 'https://linear.app/team/issue/ENG-123/issue-title')"
          ),
      },
      getLinearIssue,
      {
        annotations: {
          readOnlyHint: true, // This tool doesn't modify anything
          destructiveHint: false, // This tool doesn't make destructive changes
          idempotentHint: true, // Repeated calls have the same effect
          openWorldHint: true, // This tool interacts with the external Linear API
        },
      }
    );
  • Core helper function that implements the logic to fetch a Linear issue using GraphQL API, parse URL if needed, format response. Called by the handler.
    async function fetchLinearIssue(issue, includeComments = false) {
      // Get access token from environment variable
      const accessToken = process.env.LINEAR_API_TOKEN;
    
      if (!accessToken) {
        return {
          content: [
            {
              type: "text",
              text: "Error: No Linear API token found in environment. Set the LINEAR_API_TOKEN environment variable.",
            },
          ],
          isError: true,
        };
      }
      try {
        let issueId = issue;
    
        // Check if it's a URL and extract the ID if it is
        if (issue.startsWith("http")) {
          const parsedId = parseIssueIDFromURL(issue);
          if (!parsedId) {
            return {
              content: [
                {
                  type: "text",
                  text: `Error: Invalid Linear issue URL: ${issue}`,
                },
              ],
              isError: true,
            };
          }
          issueId = parsedId;
        }
    
        const data = await linearApiRequest(
          issueQuery,
          { id: issueId, includeComments },
          accessToken
        );
    
        if (!data.issue) {
          return {
            content: [
              {
                type: "text",
                text: `Error: Linear issue not found: ${issue}`,
              },
            ],
            isError: true,
          };
        }
    
        const issueData = data.issue;
    
        // Format the base issue data
        const formattedIssue = {
          identifier: issueData.identifier,
          title: issueData.title,
          url: issueData.url,
          description: issueData.description || "",
          state: issueData.state?.name || "",
          priority: issueData.priorityLabel || "",
          assignee: issueData.assignee
            ? issueData.assignee.displayName || issueData.assignee.name
            : "Unassigned",
          createdAt: new Date(issueData.createdAt).toISOString(),
          updatedAt: new Date(issueData.updatedAt).toISOString(),
        };
    
        // Add comments if requested
        if (includeComments && issueData.comments) {
          const formattedComments = (issueData.comments.nodes || []).map(
            (comment) => ({
              body: comment.body,
              author: comment.user
                ? comment.user.displayName || comment.user.name
                : "Unknown",
              createdAt: new Date(comment.createdAt).toISOString(),
            })
          );
          formattedIssue.comments = formattedComments;
        }
    
        return {
          content: [
            {
              type: "text",
              text: JSON.stringify(formattedIssue, null, 2),
            },
          ],
        };
      } catch (error) {
        return {
          content: [
            {
              type: "text",
              text: `Error fetching Linear issue${
                includeComments ? " with comments" : ""
              }: ${error.message}`,
            },
          ],
          isError: true,
        };
      }
    }
  • Helper function to parse Linear issue ID from a full URL, used in fetchLinearIssue.
     * Extracts an issue ID from a Linear URL
     * @param {string} url - The Linear issue URL
     * @returns {string|null} - The extracted issue ID or null if not a valid Linear issue URL
     */
    function parseIssueIDFromURL(urlStr) {
      try {
        const url = new URL(urlStr);
        if (!url.hostname.endsWith("linear.app")) {
          return null;
        }
        const match = url.pathname.match(/\/issue\/([a-zA-Z0-9_-]+)/);
        return match ? match[1] : null;
      } catch (e) {
        return null;
      }
    }
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries the full burden of behavioral disclosure. It states the tool fetches details, implying a read-only operation, but doesn't mention potential behaviors like error handling, authentication requirements, rate limits, or what happens with invalid inputs. This leaves significant gaps for an agent to understand how to use it effectively.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, well-structured sentence that efficiently conveys the core functionality without any unnecessary words. It is front-loaded with the main action and appropriately sized for the tool's simplicity.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool's low complexity (1 parameter, no output schema, no annotations), the description is adequate but incomplete. It covers the basic purpose and input but lacks details on behavioral aspects like error cases or output format, which are important for an agent to use the tool correctly without annotations.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The schema description coverage is 100%, with the parameter 'issue' fully documented in the schema. The description adds minimal value by reiterating the input requirement but doesn't provide additional semantics beyond what the schema already covers, such as examples of valid identifiers or URL formats not in the schema.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool's purpose with a specific verb ('fetch') and resource ('details of a single Linear issue'), making it easy to understand what the tool does. However, it doesn't explicitly differentiate from its sibling tool 'linear_get_issue_with_comments', which likely fetches issue details with additional comment data.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description implies usage by specifying the required input ('by providing its URL or identifier'), but it doesn't provide explicit guidance on when to use this tool versus its sibling or other alternatives. No context about when-not-to-use or comparisons are included.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

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/keegancsmith/linear-issues-mcp-server'

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