Skip to main content
Glama
keegancsmith

Linear Issues MCP Server

by keegancsmith

linear_get_issue_with_comments

Retrieve a Linear issue with all comments and complete details using its URL or identifier. This tool fetches issue information for analysis and collaboration.

Instructions

Fetch a Linear issue with all its comments and complete information.

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 that executes the core logic for the linear_get_issue_with_comments tool by invoking the shared fetchLinearIssue helper with comments enabled.
     * Tool handler for linear_get_issue_with_comments - Fetches a Linear issue with its comments
     * @param {Object} params - Parameters from the tool call
     * @param {string} params.issue - Linear issue URL or ID
     * @returns {Object} - Response object with issue details and comments or error
     */
    async function getLinearIssueWithComments({ issue }) {
      return fetchLinearIssue(issue, true);
    }
  • Zod input schema defining the 'issue' parameter as a string with description.
    {
      issue: z
        .string()
        .describe(
          "Linear issue URL or identifier (e.g., 'ENG-123' or 'https://linear.app/team/issue/ENG-123/issue-title')"
        ),
    },
  • MCP server tool registration including name, description, schema, handler, and annotations.
    server.tool(
      "linear_get_issue_with_comments",
      "Fetch a Linear issue with all its comments and complete information.",
      {
        issue: z
          .string()
          .describe(
            "Linear issue URL or identifier (e.g., 'ENG-123' or 'https://linear.app/team/issue/ENG-123/issue-title')"
          ),
      },
      getLinearIssueWithComments,
      {
        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
        },
      }
    );
  • Shared helper function that implements the main logic for fetching Linear issues via GraphQL API, parsing URLs, handling authentication, formatting data including comments, and error handling.
    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,
        };
      }
    }
Behavior2/5

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

With no annotations provided, the description carries full burden for behavioral disclosure. It states this is a fetch operation (implying read-only) and mentions it returns comments and complete information, but doesn't address authentication requirements, rate limits, error conditions, or what 'complete information' specifically includes beyond comments. This leaves significant gaps for a tool that presumably accesses external data.

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, efficient sentence that immediately communicates the core functionality. Every word serves a purpose - 'Fetch' establishes the action, 'Linear issue' specifies the resource, and 'with all its comments and complete information' clarifies the scope. No wasted words or unnecessary elaboration.

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

Completeness2/5

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

For a tool that fetches external data with no annotations and no output schema, the description is insufficient. It doesn't explain what authentication is needed, how errors are handled, what format the returned data takes, or what 'complete information' encompasses. The agent would be left guessing about important operational aspects of this data retrieval tool.

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?

Schema description coverage is 100%, with the single parameter 'issue' well-documented in the schema as accepting URLs or identifiers. The description doesn't add any parameter-specific information beyond what the schema already provides, so it meets the baseline for high schema coverage.

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 action ('Fetch') and resource ('Linear issue'), specifying it includes 'all its comments and complete information'. This distinguishes it from the sibling tool 'linear_get_issue' which presumably lacks comments, though the distinction isn't explicitly stated in the description itself.

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

Usage Guidelines2/5

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

No guidance is provided on when to use this tool versus alternatives. The existence of sibling tool 'linear_get_issue' suggests there are multiple ways to retrieve issues, but the description doesn't explain when to choose this comprehensive version over the basic one or other potential options.

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