Skip to main content
Glama
magarcia

Linear MCP Server

linear_get_attachments

Retrieve file attachments associated with a specific Linear issue to access supporting documents and media files.

Instructions

Get attachments for an issue in Linear

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
issueIdYesIssue ID to get attachments for

Implementation Reference

  • The main handler function that implements the tool logic: validates the issueId input, uses mock data to simulate fetching attachments from Linear, formats the response as JSON, and handles errors.
    export const linearGetAttachmentsHandler = async (
      args: ToolArgs
    ): Promise<{
      content: Array<{ type: string; text: string }>;
      isError?: boolean;
    }> => {
      try {
        // Type check and validate the input
        if (!args.issueId || typeof args.issueId !== 'string') {
          throw new Error('Issue ID is required and must be a string');
        }
    
        // Extract the issueId
        const issueId = args.issueId;
    
        // In a real implementation, we would use linearClient.issue(issueId)
        // and then issue.attachments()
    
        // First, check if issue exists
        const mockIssues: Record<string, { id: string; title: string; attachments: AttachmentData[] }> =
          {
            issue1: {
              id: 'issue1',
              title: 'Test Issue 1',
              attachments: [
                {
                  id: 'attachment1',
                  url: 'https://example.com/doc1.pdf',
                  title: 'Requirements Document',
                  subtitle: 'Project requirements',
                  icon: 'https://example.com/pdf-icon.png',
                  createdAt: '2023-03-01T12:00:00Z',
                },
                {
                  id: 'attachment2',
                  url: 'https://example.com/design.png',
                  title: 'Design Mockup',
                  subtitle: 'UI design',
                  icon: 'https://example.com/image-icon.png',
                  createdAt: '2023-03-02T14:30:00Z',
                },
              ],
            },
            issue2: {
              id: 'issue2',
              title: 'Test Issue 2',
              attachments: [
                {
                  id: 'attachment3',
                  url: 'https://example.com/spec.pdf',
                  title: 'Technical Specification',
                  createdAt: '2023-03-03T09:15:00Z',
                },
              ],
            },
            issue3: {
              id: 'issue3',
              title: 'Test Issue 3',
              attachments: [],
            },
          };
    
        if (!mockIssues[issueId]) {
          throw new Error(`Issue with ID ${issueId} not found`);
        }
    
        const attachments = mockIssues[issueId].attachments;
    
        // Format the response
        return {
          content: [
            {
              type: 'text',
              text: JSON.stringify(
                {
                  success: true,
                  issueId,
                  issueTitle: mockIssues[issueId].title,
                  attachments,
                  totalCount: attachments.length,
                },
                null,
                2
              ),
            },
          ],
        };
      } catch (error) {
        console.error('Error in linear_get_attachments:', error);
        return {
          content: [
            {
              type: 'text',
              text: `Error: ${(error as Error).message || String(error)}`,
            },
          ],
          isError: true,
        };
      }
    };
  • Tool definition object containing the name, description, and inputSchema for parameter validation (requires 'issueId' string).
    export const linearGetAttachmentsTool = {
      name: 'linear_get_attachments',
      description: 'Get attachments for an issue in Linear',
      inputSchema: {
        type: 'object' as const,
        properties: {
          issueId: {
            type: 'string',
            description: 'Issue ID to get attachments for',
          },
        },
        required: ['issueId'],
      },
    };
  • Registers the tool definition and handler function with the MCP registry.
    registerTool(linearGetAttachmentsTool, linearGetAttachmentsHandler);
Behavior2/5

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

With no annotations provided, the description carries the full burden of behavioral disclosure. It states the action but does not cover critical traits like whether this is a read-only operation, potential rate limits, authentication needs, or return format. This leaves significant gaps for a tool that interacts with 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 directly states the tool's purpose without unnecessary words. It is front-loaded and appropriately sized, making it easy to parse quickly.

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?

Given the lack of annotations and output schema, the description is incomplete. It does not address behavioral aspects like safety, performance, or return values, which are crucial for a data retrieval tool. This leaves the agent with insufficient context to use the tool effectively beyond basic invocation.

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 single parameter 'issueId' fully documented in the schema. The description adds no additional meaning beyond what the schema provides, such as format examples or constraints, so it meets the baseline for high schema coverage without enhancing parameter understanding.

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 ('Get') and resource ('attachments for an issue'), making the purpose understandable. However, it does not differentiate from siblings like linear_get_issue_relations or linear_get_labels, which also retrieve issue-related data, so it lacks specificity for distinction.

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?

The description provides no guidance on when to use this tool versus alternatives, such as linear_search_issues for broader queries or linear_get_issue_relations for related data. It implies usage by specifying the resource but offers no explicit context or exclusions.

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

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