Skip to main content
Glama

ado_add_attachment

Add attachments to Azure DevOps work items by uploading new files or linking existing ones to track documentation and related assets.

Instructions

Agrega un adjunto a un Work Item existente. Puede subir un archivo nuevo o vincular uno ya subido.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
workItemIdYesID del Work Item
filePathNoRuta del archivo a subir (opcional si se usa attachmentUrl)
attachmentUrlNoURL de un adjunto ya subido (opcional si se usa filePath)
commentNoComentario para el adjunto

Implementation Reference

  • Implementation of the 'ado_add_attachment' tool in src/index.ts, handling both raw file uploads and linking pre-existing attachment URLs to Azure DevOps Work Items.
    server.tool(
      "ado_add_attachment",
      "Agrega un adjunto a un Work Item existente. Puede subir un archivo nuevo o vincular uno ya subido.",
      {
        workItemId: z.number().describe("ID del Work Item"),
        filePath: z.string().optional().describe("Ruta del archivo a subir (opcional si se usa attachmentUrl)"),
        attachmentUrl: z.string().optional().describe("URL de un adjunto ya subido (opcional si se usa filePath)"),
        comment: z.string().optional().describe("Comentario para el adjunto"),
      },
      async ({ workItemId, filePath, attachmentUrl, comment }) => {
        const api = await getWitApi();
    
        let url = attachmentUrl;
    
        // Si se proporciona un archivo, subirlo primero usando REST API
        if (filePath) {
          if (!currentPat || !currentOrg) {
            throw new Error("No hay conexión configurada. Usa ado_configure primero.");
          }
    
          if (!fs.existsSync(filePath)) {
            throw new Error(`El archivo no existe: ${filePath}`);
          }
    
          const fileName = path.basename(filePath);
          const attachment = await uploadAttachmentRest(filePath, fileName);
          url = attachment.url;
        }
    
        if (!url) {
          throw new Error("Debe proporcionar filePath o attachmentUrl");
        }
    
        // Vincular el adjunto al Work Item
        const patchDocument: VSSInterfaces.JsonPatchOperation[] = [
          {
            op: VSSInterfaces.Operation.Add,
            path: "/relations/-",
            value: {
              rel: "AttachedFile",
              url: url,
              attributes: {
                comment: comment || "",
              },
            },
          },
        ];
    
        await api.updateWorkItem(null, patchDocument, workItemId);
    
        return {
          content: [
            {
              type: "text",
              text: `Adjunto agregado exitosamente al Work Item #${workItemId}\n- URL: ${url}`,
            },
          ],
        };
      }
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 this is an additive operation ('Agrega') but doesn't mention permission requirements, rate limits, file size constraints, or what happens on success/failure. For a mutation tool with zero annotation coverage, this leaves significant gaps in understanding its behavior.

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

Conciseness4/5

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

The description is concise (two sentences) and front-loaded with the core purpose. Every sentence adds value: the first states the action and target, the second explains the two attachment methods. There's no redundant or wasted text.

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 4 parameters, no annotations, and no output schema, the description is incomplete. It doesn't cover behavioral aspects like permissions, error handling, or response format, nor does it provide usage guidance relative to sibling tools. The schema handles parameter documentation, but the description lacks necessary context for safe and effective use.

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%, so all parameters are documented in the schema. The description adds minimal value beyond the schema by mentioning the two attachment methods (upload new file or link existing one), but doesn't provide additional context about parameter interactions or usage examples. Baseline 3 is appropriate when 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 action ('Agrega un adjunto') and target resource ('a un Work Item existente'), distinguishing it from sibling tools like ado_upload_attachment (which uploads without attaching) or ado_update_work_item (which modifies the work item itself). However, it doesn't explicitly differentiate from ado_get_attachments, which retrieves attachments rather than adding them.

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 ado_upload_attachment (for uploading files separately) or ado_update_work_item (for other modifications). It mentions two attachment methods but doesn't explain when to choose one over the other or any prerequisites beyond the required workItemId.

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/soulberto/mcp-azure'

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