Skip to main content
Glama
KS-GEN-AI

Jira MCP Server

by KS-GEN-AI

add_attachment_from_public_url

Attach files from public URLs to Jira tickets using the Jira API. Provide issue ID/key and image URL to add attachments.

Instructions

Add an attachment from a public url to a ticket on Jira on the api /rest/api/3/issue/{issueIdOrKey}/attachments. Do not use markdown in your query.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
issueIdOrKeyYesThe issue id or key
imageUrlYesThe URL of the image to attach

Implementation Reference

  • Handler case for 'add_attachment_from_public_url' tool in the request handler switch statement. Extracts parameters issueIdOrKey and imageUrl, validates them, calls the addAttachment helper function, and returns the JSON response.
    case 'add_attachment_from_public_url': {
      const issueIdOrKey: any = request.params.arguments?.issueIdOrKey;
      const imageUrl: any = request.params.arguments?.imageUrl;
    
      if (!issueIdOrKey || !imageUrl) {
        throw new Error('Issue id or key and image URL are required');
      }
    
      const response = await addAttachment(issueIdOrKey, imageUrl);
    
      return {
        content: [
          {
            type: 'text',
            text: JSON.stringify(response, null, 2),
          },
        ],
      };
    }
  • Helper function that implements the core logic: downloads the image from the public URL as arraybuffer, creates FormData with it as 'image.png', and POSTs to Jira's attachment endpoint for the specified issue.
    async function addAttachment(
      issueIdOrKey: string,
      imageUrl: string,
    ): Promise<any> {
      try {
        // Télécharger l'image depuis l'URL
        const imageResponse = await axios.get(imageUrl, {
          responseType: 'arraybuffer',
        });
        const formData = new FormData();
        formData.append('file', new Blob([imageResponse.data]), 'image.png');
    
        // Headers spéciaux pour l'upload de fichiers
        const headers = {
          ...getAuthHeaders().headers,
          'X-Atlassian-Token': 'no-check',
          'Content-Type': 'multipart/form-data',
        };
    
        const response = await axios.post(
          `${JIRA_URL}/rest/api/3/issue/${issueIdOrKey}/attachments`,
          formData,
          { headers },
        );
    
        return response.data;
      } catch (error: any) {
        return {
          error: error.response?.data || error.message,
        };
      }
    }
  • src/index.ts:243-261 (registration)
    Tool registration in the tools array passed to server.setTools, including name, description, and input schema.
    {
      name: 'add_attachment_from_public_url',
      description:
        'Add an attachment from a public url to a ticket on Jira on the api /rest/api/3/issue/{issueIdOrKey}/attachments. Do not use markdown in your query.',
      inputSchema: {
        type: 'object',
        properties: {
          issueIdOrKey: {
            type: 'string',
            description: 'The issue id or key',
          },
          imageUrl: {
            type: 'string',
            description: 'The URL of the image to attach',
          },
        },
        required: ['issueIdOrKey', 'imageUrl'],
      },
    },
  • Input schema defining the expected arguments: issueIdOrKey (string) and imageUrl (string), both required.
    inputSchema: {
      type: 'object',
      properties: {
        issueIdOrKey: {
          type: 'string',
          description: 'The issue id or key',
        },
        imageUrl: {
          type: 'string',
          description: 'The URL of the image to attach',
        },
      },
      required: ['issueIdOrKey', 'imageUrl'],
    },

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observed

TDQS

A3.5/5.0
Behavior3/5

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

With no annotations, the description carries the burden. It adds a behavioral instruction ('Do not use markdown in your query') and references the API endpoint, but does not disclose potential side effects, permission requirements, or constraints (e.g., URL must be publicly accessible).

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?

Two sentences, no redundancy. The first sentence states the core function, the second adds a key caveat. Efficient and front-loaded.

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?

For a simple creation tool with no output schema, the description is adequate but missing details like return value, failure modes, and the requirement that the URL be publicly accessible. Could be more complete.

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 coverage is 100% with clear descriptions for both parameters. The description adds no extra semantic meaning beyond the schema, thus baseline 3 is appropriate. The 'Do not use markdown' note is a general instruction, not parameter-specific.

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

Purpose5/5

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

The description clearly states the verb ('Add'), resource ('attachment'), source ('from a public url'), and target ('to a ticket on Jira'), distinguishing it from the sibling 'add_attachment_from_confluence' which uses a different source. The mention of the API endpoint reinforces the purpose.

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 on when to use this tool versus alternatives like 'add_attachment_from_confluence' or 'edit_ticket'. The description lacks explicit context for selection, leaving the agent to infer.

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