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),

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