Skip to main content
Glama
magarcia

Linear MCP Server

linear_add_attachment

Attach files or links to Linear issues by providing the issue ID, URL, and title to organize project resources.

Instructions

Add an attachment to an issue in Linear

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
iconNoIcon URL for attachment
issueIdYesIssue ID to add attachment to
subtitleNoSubtitle for attachment
titleYesTitle of attachment
urlYesURL of attachment

Implementation Reference

  • The handler function that executes the tool logic: input validation, URL check, mock issue/attachment handling, and formatted response.
    export const linearAddAttachmentHandler = 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');
        }
    
        if (!args.url || typeof args.url !== 'string') {
          throw new Error('URL is required and must be a string');
        }
    
        if (!args.title || typeof args.title !== 'string') {
          throw new Error('Title is required and must be a string');
        }
    
        // Extract and type the arguments properly
        const attachment: AddAttachmentArgs = {
          issueId: args.issueId,
          url: args.url,
          title: args.title,
          subtitle: args.subtitle as string | undefined,
          icon: args.icon as string | undefined,
        };
    
        const { issueId, url, title, subtitle, icon } = attachment;
    
        // Validate URL format
        try {
          new URL(url);
        } catch (e) {
          throw new Error('Invalid URL format');
        }
    
        // In a real implementation, we would use linearClient.issue(issueId)
        // and then issue.attachments.create()
    
        // First, check if issue exists
        const mockIssues: Record<string, { id: string; title: string }> = {
          issue1: { id: 'issue1', title: 'Test Issue 1' },
          issue2: { id: 'issue2', title: 'Test Issue 2' },
        };
    
        if (!mockIssues[issueId]) {
          throw new Error(`Issue with ID ${issueId} not found`);
        }
    
        // For simulation purposes, we'll return a mock response
        const mockAttachment: AttachmentData = {
          id: `attachment-${Date.now()}`,
          url,
          title,
          subtitle,
          icon,
          createdAt: new Date().toISOString(),
        };
    
        // Format the response
        return {
          content: [
            {
              type: 'text',
              text: JSON.stringify(
                {
                  success: true,
                  attachment: mockAttachment,
                },
                null,
                2
              ),
            },
          ],
        };
      } catch (error) {
        console.error('Error in linear_add_attachment:', error);
        return {
          content: [
            {
              type: 'text',
              text: `Error: ${(error as Error).message || String(error)}`,
            },
          ],
          isError: true,
        };
      }
    };
  • Tool schema definition with name, description, and inputSchema specifying required (issueId, url, title) and optional (subtitle, icon) parameters.
    export const linearAddAttachmentTool = {
      name: 'linear_add_attachment',
      description: 'Add an attachment to an issue in Linear',
      inputSchema: {
        type: 'object' as const,
        properties: {
          issueId: {
            type: 'string',
            description: 'Issue ID to add attachment to',
          },
          url: {
            type: 'string',
            description: 'URL of attachment',
          },
          title: {
            type: 'string',
            description: 'Title of attachment',
          },
          subtitle: {
            type: 'string',
            description: 'Subtitle for attachment',
          },
          icon: {
            type: 'string',
            description: 'Icon URL for attachment',
          },
        },
        required: ['issueId', 'url', 'title'],
      },
    };
  • Registers the linear_add_attachment tool with its schema and handler function.
    registerTool(linearAddAttachmentTool, linearAddAttachmentHandler);
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 ('Add') but doesn't mention required permissions, whether this is a mutation operation, potential side effects, error conditions, or response format. This leaves significant gaps for a tool that modifies 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's appropriately sized and front-loaded with the core functionality.

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 mutation tool with no annotations and no output schema, the description is insufficient. It doesn't explain what happens after attachment addition, error handling, or behavioral context. Given the complexity of modifying issue data, more completeness is needed.

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%, so the schema already documents all 5 parameters thoroughly. The description adds no additional parameter information beyond what's in the schema, maintaining the baseline score of 3 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 ('Add an attachment') and target resource ('to an issue in Linear'), providing specific verb+resource pairing. However, it doesn't differentiate from sibling tools like linear_get_attachments or linear_update_issue, which would require explicit comparison for a score of 5.

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 about when to use this tool versus alternatives. The description doesn't mention prerequisites, exclusions, or comparisons with sibling tools like linear_get_attachments (for viewing) or linear_update_issue (which might also handle attachments).

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