Skip to main content
Glama

upload_file

Upload files to Slack channels by providing content, filename, and target channels to share documents and data within your workspace.

Instructions

Upload a file to Slack

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
channelsYesArray of channel IDs to share the file to
contentYesFile content
filenameYesFilename
titleNoFile title
initial_commentNoInitial comment

Implementation Reference

  • The main handler function for the 'upload_file' tool. It validates the input arguments using uploadFileSchema and uploads the file content to specified Slack channels using the files.uploadV2 API, returning the file object.
    export async function uploadFile(client: SlackClientWrapper, args: unknown) {
      const params = uploadFileSchema.parse(args);
    
      return await client.safeCall(async () => {
        const result = await client.getClient().files.uploadV2({
          channels: params.channels.join(','),
          content: params.content,
          filename: params.filename,
          title: params.title,
          initial_comment: params.initial_comment,
        });
    
        const maybeFile = (result && typeof result === 'object' && 'file' in result)
          ? (result as { file?: unknown }).file
          : undefined;
    
        return {
          ok: true,
          file: maybeFile,
        };
      });
    }
  • Zod schema for input validation of the upload_file tool, defining required channels array, content, filename, and optional title and initial_comment.
    export const uploadFileSchema = z.object({
      channels: z.array(channelIdSchema).min(1),
      content: z.string().min(1),
      filename: z.string().min(1),
      title: z.string().optional(),
      initial_comment: z.string().optional(),
    });
  • src/index.ts:318-350 (registration)
    MCP tool registration in the list_tools response, defining the name, description, and inputSchema for 'upload_file'.
    {
      name: 'upload_file',
      description: 'Upload a file to Slack',
      inputSchema: {
        type: 'object',
        properties: {
          channels: {
            type: 'array',
            items: {
              type: 'string',
            },
            description: 'Array of channel IDs to share the file to',
          },
          content: {
            type: 'string',
            description: 'File content',
          },
          filename: {
            type: 'string',
            description: 'Filename',
          },
          title: {
            type: 'string',
            description: 'File title',
          },
          initial_comment: {
            type: 'string',
            description: 'Initial comment',
          },
        },
        required: ['channels', 'content', 'filename'],
      },
    },
  • src/index.ts:434-434 (registration)
    Registration of the upload_file handler in the internal tool dispatch map, mapping the tool name to the fileTools.uploadFile function.
    upload_file: (args) => fileTools.uploadFile(slackClient, args),
Behavior2/5

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

With no annotations provided, the description carries full burden for behavioral disclosure but only states the basic action without mentioning permissions required, file size limits, supported formats, error conditions, or what happens upon success (e.g., does it return a file ID?). This leaves significant gaps 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.

Conciseness5/5

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

The description is a single, clear sentence with zero wasted words—it directly states the tool's function without unnecessary elaboration. This is appropriately front-loaded and efficient for a straightforward tool.

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 5 parameters, no annotations, and no output schema, the description is inadequate. It doesn't cover behavioral aspects like authentication needs, rate limits, or return values, leaving the agent with insufficient context to use the tool effectively beyond basic inference.

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 context beyond implying file upload functionality, which aligns with the schema but doesn't provide extra value like usage examples or constraints.

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 ('upload') and target resource ('a file to Slack'), making the purpose immediately understandable. However, it doesn't differentiate from sibling tools like 'send_message' or 'send_formatted_message' which might also involve file sharing in some contexts, so it doesn't reach the highest score.

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 'send_message' (which might handle attachments differently) or other file-related operations. There's no mention of prerequisites, constraints, or typical use cases beyond the basic action.

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/Hais/slack-bot-mcp'

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