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'],
    },
Behavior2/5

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

With no annotations provided, the description carries full burden but only states the action and API endpoint. It doesn't disclose behavioral traits such as required permissions, rate limits, file size restrictions, supported URL types, or what happens on success/failure. The mention of 'Do not use markdown in your query' adds minor context but is insufficient for a mutation tool.

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

Conciseness3/5

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

The description is two sentences but could be more front-loaded; the first sentence is clear, but the second about markdown feels tacked on and not core to the tool's purpose. It's reasonably sized but not optimally structured, with some wasted space on non-essential details.

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 this is a mutation tool with no annotations and no output schema, the description is incomplete. It lacks information on permissions, error handling, return values, or constraints like URL accessibility. The API endpoint detail is useful but doesn't compensate for missing behavioral context needed for safe 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?

Schema description coverage is 100%, so the schema already documents both parameters ('issueIdOrKey' and 'imageUrl'). The description adds no additional meaning beyond implying 'imageUrl' must be a public URL, which is somewhat redundant with the schema. Baseline 3 is appropriate as the schema does the heavy lifting.

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 verb 'add' and resource 'attachment from a public url to a ticket on Jira', specifying the exact API endpoint. It distinguishes from sibling 'add_attachment_from_confluence' by specifying 'public url' vs 'confluence', though not explicitly named. However, it lacks full sibling differentiation beyond the URL source.

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 like 'add_attachment_from_confluence' or other attachment methods. It only includes a technical note about not using markdown in queries, which is not usage guidance. No context, exclusions, or prerequisites are mentioned.

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/KS-GEN-AI/jira-mcp-server'

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