Skip to main content
Glama
piekstra

Slack MCP Server

by piekstra

upload_file

Upload files directly to specified Slack channels. Provide file content, name, title, and an optional initial comment to share documents or updates efficiently.

Instructions

Upload a file to one or more Slack channels.

Args: channels: Comma-separated list of channel IDs content: File content as text filename: Name for the file title: Title of the file initial_comment: Initial comment for the file

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
channelsYes
contentYes
filenameYes
initial_commentNo
titleNo

Implementation Reference

  • MCP tool handler for 'upload_file'. Registers the tool and implements the logic: parses comma-separated channels, instantiates SlackClient, calls its upload_file method with parameters, returns JSON response or error.
    @mcp.tool() async def upload_file( channels: str, content: str, filename: str, title: Optional[str] = None, initial_comment: Optional[str] = None ) -> str: """ Upload a file to one or more Slack channels. Args: channels: Comma-separated list of channel IDs content: File content as text filename: Name for the file title: Title of the file initial_comment: Initial comment for the file """ try: client = SlackClient() channels_list = channels.split(",") result = await client.upload_file(channels_list, content, filename, title, initial_comment) return json.dumps(result, indent=2) except Exception as e: return json.dumps({"error": str(e)}, indent=2)
  • SlackClient helper method that constructs the API request payload for Slack's files.upload endpoint and calls the generic _make_request method to perform the HTTP POST.
    async def upload_file( self, channels: List[str], content: str, filename: str, title: Optional[str] = None, initial_comment: Optional[str] = None, ) -> Dict[str, Any]: """Upload a file to one or more channels.""" data = {"channels": ",".join(channels), "content": content, "filename": filename} if title: data["title"] = title if initial_comment: data["initial_comment"] = initial_comment return await self._make_request("POST", "files.upload", json_data=data)

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/piekstra/slack-mcp-server'

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