Skip to main content
Glama

attach_url

Attach a file from a publicly accessible URL to a Dart AI task. Specify the task ID and file URL.

Instructions

Attach a file from URL to a task. URL must be publicly accessible.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
dart_idYesTask dart_id (also accepts "id" or "task_id")
urlYesPublic URL of file to attach
filenameNoOptional filename override

Implementation Reference

  • The main handler function `handleAttachUrl` that implements the attach_url tool logic: validates input (DART_TOKEN, input object, dart_id, url, filename), constructs a DartClient, calls client.attachUrl(), and returns the result with a task_url.
    export async function handleAttachUrl(input: AttachUrlInput): Promise<AttachUrlOutput> {
      const DART_TOKEN = process.env.DART_TOKEN;
    
      if (!DART_TOKEN) {
        throw new DartAPIError(
          'DART_TOKEN environment variable is required. Get your token from: https://app.dartai.com/?settings=account',
          401
        );
      }
    
      // Validate input
      if (!input || typeof input !== 'object') {
        throw new ValidationError('Input must be an object', 'input');
      }
    
      // Accept id, task_id, or taskId as aliases for dart_id
      input.dart_id = resolveDartId(input as unknown as Record<string, unknown>);
    
      if (!input.url || typeof input.url !== 'string' || input.url.trim() === '') {
        throw new ValidationError('url is required and must be a non-empty string', 'url');
      }
    
      if (!URL_PATTERN.test(input.url.trim())) {
        throw new ValidationError(
          'url must be a valid HTTP or HTTPS URL',
          'url'
        );
      }
    
      if (input.filename !== undefined && typeof input.filename !== 'string') {
        throw new ValidationError('filename must be a string if provided', 'filename');
      }
    
      const client = new DartClient({ token: DART_TOKEN });
    
      const result = await client.attachUrl({
        dart_id: input.dart_id.trim(),
        url: input.url.trim(),
        filename: input.filename,
      });
    
      return {
        attachment_id: result.attachment_id,
        dart_id: result.dart_id,
        url: result.url,
        filename: result.filename,
        task_url: `https://app.dartai.com/task/${input.dart_id.trim()}`,
      };
    }
  • AttachUrlInput interface defining the input schema: dart_id (string), url (string), and optional filename (string).
    export interface AttachUrlInput {
      dart_id: string;
      url: string;
      filename?: string;
    }
  • AttachUrlOutput interface defining the output schema: attachment_id, dart_id, url, filename, and task_url (all strings).
    export interface AttachUrlOutput {
      attachment_id: string;
      dart_id: string;
      url: string;
      filename: string;
      task_url: string;
    }
  • src/index.ts:907-928 (registration)
    MCP tool registration for 'attach_url': defines name, description, inputSchema with dart_id, url, and optional filename properties.
    {
      name: 'attach_url',
      description: 'Attach a file from URL to a task. URL must be publicly accessible.',
      inputSchema: {
        type: 'object',
        properties: {
          dart_id: {
            type: 'string',
            description: 'Task dart_id (also accepts "id" or "task_id")',
          },
          url: {
            type: 'string',
            description: 'Public URL of file to attach',
          },
          filename: {
            type: 'string',
            description: 'Optional filename override',
          },
        },
        required: ['dart_id', 'url'],
      },
    },
  • The API client method `attachUrl` that sends a POST request to `/tasks/{dart_id}/attachments/from-url` with the url (and optional filename), then maps the response to attachment_id, dart_id, url, and filename.
    async attachUrl(input: {
      dart_id: string;
      url: string;
      filename?: string;
    }): Promise<{
      attachment_id: string;
      dart_id: string;
      url: string;
      filename: string;
    }> {
      if (!input.dart_id || typeof input.dart_id !== 'string' || input.dart_id.trim() === '') {
        throw new DartAPIError('dart_id is required and must be a non-empty string', 400);
      }
      if (!input.url || typeof input.url !== 'string' || input.url.trim() === '') {
        throw new DartAPIError('url is required and must be a non-empty string', 400);
      }
    
      const apiInput: Record<string, unknown> = {
        url: input.url,
      };
      if (input.filename !== undefined) apiInput.filename = input.filename;
    
      const response = await this.request<{ item: any }>(
        'POST',
        `/tasks/${encodeURIComponent(input.dart_id.trim())}/attachments/from-url`,
        { item: apiInput }
      );
    
      return {
        attachment_id: response.item?.id || '',
        dart_id: input.dart_id,
        url: response.item?.url || input.url,
        filename: response.item?.filename || input.filename || '',
      };
    }
Behavior3/5

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

The description discloses that the URL must be publicly accessible, a key behavioral trait. However, with no annotations, it lacks details on failure modes, authentication, or rate limits. It meets the minimum but doesn't fully cover behavioral aspects.

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 two concise sentences with no wasted words. It is front-loaded with the core action and includes an important constraint second. Every sentence is necessary.

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?

Given no annotations and no output schema, the description covers the essential purpose and constraint but does not mention return values or error handling. For a simple tool, it is minimally complete but lacks some context.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 100%, so baseline is 3. The description adds value by specifying that the URL must be publicly accessible, which is not in the parameter description. This extra constraint enhances semantics beyond the schema.

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 tool's action: attaching a file from a URL to a task. The verb 'attach' and resource 'file from URL to a task' are specific, and the constraint 'URL must be publicly accessible' adds clarity. It distinguishes from sibling tools like add_task_comment.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description implies usage for attaching publicly accessible files but does not provide explicit guidance on when to use this tool versus alternatives, nor does it mention when not to use it. No exclusions or alternatives 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/standardbeagle/dart-query'

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