Skip to content

Commit e884b21

Browse files
committed
channels prefixes fix, prompts fixes
1 parent 5477191 commit e884b21

File tree

4 files changed

+11
-9
lines changed

4 files changed

+11
-9
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ This feature-rich Slack MCP Server has:
2828
1. `conversations_history`
2929
- Get messages from the channel by channelID
3030
- Required inputs:
31-
- `channel_id` (string): ID of the channel in format Cxxxxxxxxxx or its name starting with #... aka #general.
31+
- `channel_id` (string): ID of the channel in format Cxxxxxxxxxx or its name starting with #... or @... aka #general or @username_dm.
3232
- `include_activity_messages` (bool, default: false): If true, the response will include activity messages such as 'channel_join' or 'channel_leave'. Default is boolean false.
3333
- `cursor` (string, default: ""): Cursor for pagination. Use the value of the last row and column in the response as next_cursor field returned from the previous request.
3434
- `limit` (string, default: 28): Limit of messages to fetch.
@@ -37,7 +37,7 @@ This feature-rich Slack MCP Server has:
3737
2. `conversations_replies`
3838
- Get a thread of messages posted to a conversation by channelID and thread_ts
3939
- Required inputs:
40-
- `channel_id` (string): ID of the channel in format Cxxxxxxxxxx or its name starting with #... aka #general.
40+
- `channel_id` (string): ID of the channel in format Cxxxxxxxxxx or its name starting with #... or @... aka #general or @username_dm.
4141
- `thread_ts` (string): Unique identifier of either a thread’s parent message or a message in the thread. ts must be the timestamp in format 1234567890.123456 of an existing message with 0 or more replies.
4242
- `include_activity_messages` (bool, default: false): If true, the response will include activity messages such as 'channel_join' or 'channel_leave'. Default is boolean false.
4343
- `cursor` (string, default: ""): Cursor for pagination. Use the value of the last row and column in the response as next_cursor field returned from the previous request.

pkg/handler/conversations.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,7 @@ func (ch *ConversationsHandler) parseParams(request mcp.CallToolRequest) (*conve
181181
}
182182
}
183183

184-
if strings.HasPrefix(channel, "#") {
184+
if strings.HasPrefix(channel, "#") || strings.HasPrefix(channel, "@") {
185185
channelsMaps := ch.apiProvider.ProvideChannelsMaps()
186186
chn, ok := channelsMaps.ChannelsInv[channel]
187187
if !ok {

pkg/provider/api.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -367,7 +367,7 @@ func (ap *ApiProvider) GetChannels(ctx context.Context, channelTypes []string) [
367367

368368
for _, ch := range chans {
369369
ap.channels[ch.ID] = ch
370-
ap.channelsInv["#"+ch.Name] = ch.ID
370+
ap.channelsInv[ch.Name] = ch.ID
371371
}
372372

373373
if nextcur == "" {
@@ -496,7 +496,7 @@ func mapChannel(
496496
isIM, isMpIM, isPrivate bool,
497497
usersMap map[string]slack.User,
498498
) Channel {
499-
channelName := "#" + name
499+
channelName := name
500500
finalPurpose := purpose
501501
finalTopic := topic
502502
finalMemberCount := numMembers
@@ -526,6 +526,8 @@ func mapChannel(
526526
finalPurpose = "Group DM with " + strings.Join(userNames, ", ")
527527
finalTopic = ""
528528
}
529+
} else {
530+
channelName = "#" + nameNormalized
529531
}
530532

531533
return Channel{

pkg/server/server.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,18 +16,18 @@ type MCPServer struct {
1616
func NewMCPServer(provider *provider.ApiProvider) *MCPServer {
1717
s := server.NewMCPServer(
1818
"Slack MCP Server",
19-
"1.1.15",
19+
"1.1.17",
2020
server.WithLogging(),
2121
server.WithRecovery(),
2222
)
2323

2424
conversationsHandler := handler.NewConversationsHandler(provider)
2525

2626
s.AddTool(mcp.NewTool("conversations_history",
27-
mcp.WithDescription("Get messages from the channel by channel_id, the last row/column in the response is used as 'cursor' parameter for pagination if not empty"),
27+
mcp.WithDescription("Get messages from the channel (or DM) by channel_id, the last row/column in the response is used as 'cursor' parameter for pagination if not empty"),
2828
mcp.WithString("channel_id",
2929
mcp.Required(),
30-
mcp.Description("ID of the channel in format Cxxxxxxxxxx or its name starting with #... aka #general."),
30+
mcp.Description(" - `channel_id` (string): ID of the channel in format Cxxxxxxxxxx or its name starting with #... or @... aka #general or @username_dm."),
3131
),
3232
mcp.WithBoolean("include_activity_messages",
3333
mcp.Description("If true, the response will include activity messages such as 'channel_join' or 'channel_leave'. Default is boolean false."),
@@ -46,7 +46,7 @@ func NewMCPServer(provider *provider.ApiProvider) *MCPServer {
4646
mcp.WithDescription("Get a thread of messages posted to a conversation by channelID and thread_ts, the last row/column in the response is used as 'cursor' parameter for pagination if not empty"),
4747
mcp.WithString("channel_id",
4848
mcp.Required(),
49-
mcp.Description("ID of the channel in format Cxxxxxxxxxx or its name starting with #... aka #general."),
49+
mcp.Description("ID of the channel in format Cxxxxxxxxxx or its name starting with #... or @... aka #general or @username_dm."),
5050
),
5151
mcp.WithString("thread_ts",
5252
mcp.Required(),

0 commit comments

Comments
 (0)