feat(tools): add files_list tool for listing Slack channel files#261
Open
aureliomalheiros wants to merge 1 commit intokorotovsky:masterfrom
Open
feat(tools): add files_list tool for listing Slack channel files#261aureliomalheiros wants to merge 1 commit intokorotovsky:masterfrom
aureliomalheiros wants to merge 1 commit intokorotovsky:masterfrom
Conversation
Details: - Add ListFilesContext to SlackAPI interface and MCPSlackClient implementation - Add FilesListHandler with CSV output (FileID, Name, Mimetype, Size, UserID, Permalink, Cursor) - Register files_list tool in server guarded by SLACK_MCP_FILES_LIST_TOOL env var - Support filtering by channel_id, user_id, types, limit and cursor-based pagination - Tool is read-only and disabled by default, consistent with attachment_get_data pattern
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds a new
files_listtool that lists files shared in a Slack channel or workspace, completing the file workflow alongside the existingattachment_get_datatool.Motivation
attachment_get_datadownloads a file by ID, but there was no way to discover files shared in a channel. An AI agent can now callfiles_listto find files, then use the returnedFileIDwithattachment_get_datato read the content.Changes
pkg/provider/api.goListFilesContext(ctx, params)to theSlackAPIinterfaceMCPSlackClient.ListFilesContextdelegating toslack.Client.ListFilesContextpkg/handler/conversations.gofilesListParamsstructFileListResultCSV struct (FileID, Name, Title, Mimetype, Filetype, PrettyType, Size, UserID, Created, Permalink, Curso\)parseParamsToolFilesListusingrequest.GetString(consistent with existing parsers)FilesListHandler\returning CSV output with cursor on the last rowpkg/server/server.goToolFilesList = "files_list"constantValidToolNamesNewMCPServerguarded bySLACK_MCP_FILES_LIST_TOOLenv var (same pattern asattachment_get_data)Design Decisions
attachment_get_data, requires explicit opt-in via env varListFilesContextoverGetFilesContext— cursor-based pagination is preferred over page/countgithub.com/slack-go/slackclient