bn-slack-mcp-server 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +243 -0
- package/dist/debug-middleware.d.ts +12 -0
- package/dist/debug-middleware.d.ts.map +1 -0
- package/dist/debug-middleware.js +36 -0
- package/dist/debug-middleware.js.map +1 -0
- package/dist/helpers.d.ts +86 -0
- package/dist/helpers.d.ts.map +1 -0
- package/dist/helpers.js +235 -0
- package/dist/helpers.js.map +1 -0
- package/dist/index.d.ts +9 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +162 -0
- package/dist/index.js.map +1 -0
- package/dist/schemas.d.ts +286 -0
- package/dist/schemas.d.ts.map +1 -0
- package/dist/schemas.js +840 -0
- package/dist/schemas.js.map +1 -0
- package/dist/slack-api-client.d.ts +51 -0
- package/dist/slack-api-client.d.ts.map +1 -0
- package/dist/slack-api-client.js +227 -0
- package/dist/slack-api-client.js.map +1 -0
- package/dist/tool-loader.d.ts +35 -0
- package/dist/tool-loader.d.ts.map +1 -0
- package/dist/tool-loader.js +121 -0
- package/dist/tool-loader.js.map +1 -0
- package/dist/tool-registry.d.ts +44 -0
- package/dist/tool-registry.d.ts.map +1 -0
- package/dist/tool-registry.js +56 -0
- package/dist/tool-registry.js.map +1 -0
- package/dist/tools/cache.d.ts +69 -0
- package/dist/tools/cache.d.ts.map +1 -0
- package/dist/tools/cache.js +94 -0
- package/dist/tools/cache.js.map +1 -0
- package/dist/tools/channels.d.ts +76 -0
- package/dist/tools/channels.d.ts.map +1 -0
- package/dist/tools/channels.js +251 -0
- package/dist/tools/channels.js.map +1 -0
- package/dist/tools/conversations.d.ts +77 -0
- package/dist/tools/conversations.d.ts.map +1 -0
- package/dist/tools/conversations.js +302 -0
- package/dist/tools/conversations.js.map +1 -0
- package/dist/tools/files.d.ts +15 -0
- package/dist/tools/files.d.ts.map +1 -0
- package/dist/tools/files.js +30 -0
- package/dist/tools/files.js.map +1 -0
- package/dist/tools/index.d.ts +12 -0
- package/dist/tools/index.d.ts.map +1 -0
- package/dist/tools/index.js +20 -0
- package/dist/tools/index.js.map +1 -0
- package/dist/tools/messages.d.ts +20 -0
- package/dist/tools/messages.d.ts.map +1 -0
- package/dist/tools/messages.js +40 -0
- package/dist/tools/messages.js.map +1 -0
- package/dist/tools/system.d.ts +48 -0
- package/dist/tools/system.d.ts.map +1 -0
- package/dist/tools/system.js +124 -0
- package/dist/tools/system.js.map +1 -0
- package/dist/tools/users.d.ts +69 -0
- package/dist/tools/users.d.ts.map +1 -0
- package/dist/tools/users.js +179 -0
- package/dist/tools/users.js.map +1 -0
- package/dist/tools/workspace.d.ts +50 -0
- package/dist/tools/workspace.d.ts.map +1 -0
- package/dist/tools/workspace.js +56 -0
- package/dist/tools/workspace.js.map +1 -0
- package/dist/types.d.ts +160 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +2 -0
- package/dist/types.js.map +1 -0
- package/package.json +48 -0
- package/tools.json +483 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cache.d.ts","sourceRoot":"","sources":["../../src/tools/cache.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AACvC,OAAO,KAAK,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAI7B,OAAO,KAAK,EACV,qBAAqB,EACrB,eAAe,EACf,gBAAgB,EACjB,MAAM,eAAe,CAAC;AAEvB;;GAEG;AACH,wBAAsB,eAAe,CACnC,GAAG,EAAE,OAAO,EACZ,KAAK,EAAE,CAAC,CAAC,KAAK,CAAC,OAAO,qBAAqB,CAAC;;;;;;;;;;;;;;GA2B7C;AAED;;GAEG;AACH,wBAAsB,SAAS,CAC7B,GAAG,EAAE,OAAO,EACZ,KAAK,EAAE,CAAC,CAAC,KAAK,CAAC,OAAO,eAAe,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCvC;AAED;;GAEG;AACH,wBAAsB,UAAU,CAC9B,GAAG,EAAE,OAAO,EACZ,IAAI,EAAE,CAAC,CAAC,KAAK,CAAC,OAAO,gBAAgB,CAAC;;;;GA4BvC"}
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Cache tool handlers for Slack MCP Server
|
|
3
|
+
*/
|
|
4
|
+
import { dirname } from "path";
|
|
5
|
+
import { getSlackClient } from "../slack-api-client.js";
|
|
6
|
+
import { getCacheFileInfo, deleteCache } from "../helpers.js";
|
|
7
|
+
/**
|
|
8
|
+
* Initialize both user and channel caches by fetching fresh data
|
|
9
|
+
*/
|
|
10
|
+
export async function initializeCache(req, _args) {
|
|
11
|
+
const client = getSlackClient(req);
|
|
12
|
+
// Force cache creation by calling both cache methods
|
|
13
|
+
const users = await client.getCachedUsers();
|
|
14
|
+
const channels = await client.getCachedChannels();
|
|
15
|
+
// Get file info after creation
|
|
16
|
+
const usersInfo = getCacheFileInfo(client.usersCacheFile);
|
|
17
|
+
const channelsInfo = getCacheFileInfo(client.channelsCacheFile);
|
|
18
|
+
return {
|
|
19
|
+
success: true,
|
|
20
|
+
message: "Cache initialized successfully",
|
|
21
|
+
users_cache: {
|
|
22
|
+
path: client.usersCacheFile,
|
|
23
|
+
size_kb: usersInfo.size_kb,
|
|
24
|
+
count: users.length,
|
|
25
|
+
},
|
|
26
|
+
channels_cache: {
|
|
27
|
+
path: client.channelsCacheFile,
|
|
28
|
+
size_kb: channelsInfo.size_kb,
|
|
29
|
+
count: channels.length,
|
|
30
|
+
},
|
|
31
|
+
total_cache_size_kb: usersInfo.size_kb + channelsInfo.size_kb,
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Get information about cache file locations, sizes, and last updated times
|
|
36
|
+
*/
|
|
37
|
+
export async function cacheInfo(req, _args) {
|
|
38
|
+
const client = getSlackClient(req);
|
|
39
|
+
const usersInfo = getCacheFileInfo(client.usersCacheFile);
|
|
40
|
+
const channelsInfo = getCacheFileInfo(client.channelsCacheFile);
|
|
41
|
+
// Get cache directory info
|
|
42
|
+
const cacheDir = dirname(usersInfo.absolute_path);
|
|
43
|
+
return {
|
|
44
|
+
success: true,
|
|
45
|
+
cache_directory: cacheDir,
|
|
46
|
+
users_cache: {
|
|
47
|
+
configured_path: client.usersCacheFile,
|
|
48
|
+
...usersInfo,
|
|
49
|
+
},
|
|
50
|
+
channels_cache: {
|
|
51
|
+
configured_path: client.channelsCacheFile,
|
|
52
|
+
...channelsInfo,
|
|
53
|
+
},
|
|
54
|
+
environment_variables: {
|
|
55
|
+
SLACK_MCP_USERS_CACHE: process.env.SLACK_MCP_USERS_CACHE || "Not set (using default)",
|
|
56
|
+
SLACK_MCP_CHANNELS_CACHE: process.env.SLACK_MCP_CHANNELS_CACHE || "Not set (using default)",
|
|
57
|
+
},
|
|
58
|
+
recommendations: {
|
|
59
|
+
users_cache_fresh: usersInfo.exists ? usersInfo.is_fresh : false,
|
|
60
|
+
channels_cache_fresh: channelsInfo.exists ? channelsInfo.is_fresh : false,
|
|
61
|
+
total_cache_size_kb: usersInfo.size_kb + channelsInfo.size_kb,
|
|
62
|
+
},
|
|
63
|
+
};
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* Clear cache files to force refresh from Slack API
|
|
67
|
+
*/
|
|
68
|
+
export async function clearCache(req, args) {
|
|
69
|
+
const client = getSlackClient(req);
|
|
70
|
+
const { cache_type = "both" } = args;
|
|
71
|
+
const cleared = [];
|
|
72
|
+
if (cache_type === "users" || cache_type === "both") {
|
|
73
|
+
if (deleteCache(client.usersCacheFile)) {
|
|
74
|
+
cleared.push(`Users cache: ${client.usersCacheFile}`);
|
|
75
|
+
}
|
|
76
|
+
else {
|
|
77
|
+
cleared.push("Users cache: (file didn't exist)");
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
if (cache_type === "channels" || cache_type === "both") {
|
|
81
|
+
if (deleteCache(client.channelsCacheFile)) {
|
|
82
|
+
cleared.push(`Channels cache: ${client.channelsCacheFile}`);
|
|
83
|
+
}
|
|
84
|
+
else {
|
|
85
|
+
cleared.push("Channels cache: (file didn't exist)");
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
return {
|
|
89
|
+
success: true,
|
|
90
|
+
cleared,
|
|
91
|
+
message: "Cache cleared successfully. Files will be recreated on next API call.",
|
|
92
|
+
};
|
|
93
|
+
}
|
|
94
|
+
//# sourceMappingURL=cache.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cache.js","sourceRoot":"","sources":["../../src/tools/cache.ts"],"names":[],"mappings":"AAAA;;GAEG;AAIH,OAAO,EAAE,OAAO,EAAE,MAAM,MAAM,CAAC;AAC/B,OAAO,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AACxD,OAAO,EAAE,gBAAgB,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAO9D;;GAEG;AACH,MAAM,CAAC,KAAK,UAAU,eAAe,CACnC,GAAY,EACZ,KAA4C;IAE5C,MAAM,MAAM,GAAG,cAAc,CAAC,GAAG,CAAC,CAAC;IAEnC,qDAAqD;IACrD,MAAM,KAAK,GAAG,MAAM,MAAM,CAAC,cAAc,EAAE,CAAC;IAC5C,MAAM,QAAQ,GAAG,MAAM,MAAM,CAAC,iBAAiB,EAAE,CAAC;IAElD,+BAA+B;IAC/B,MAAM,SAAS,GAAG,gBAAgB,CAAC,MAAM,CAAC,cAAc,CAAC,CAAC;IAC1D,MAAM,YAAY,GAAG,gBAAgB,CAAC,MAAM,CAAC,iBAAiB,CAAC,CAAC;IAEhE,OAAO;QACL,OAAO,EAAE,IAAI;QACb,OAAO,EAAE,gCAAgC;QACzC,WAAW,EAAE;YACX,IAAI,EAAE,MAAM,CAAC,cAAc;YAC3B,OAAO,EAAE,SAAS,CAAC,OAAO;YAC1B,KAAK,EAAE,KAAK,CAAC,MAAM;SACpB;QACD,cAAc,EAAE;YACd,IAAI,EAAE,MAAM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AACH,MAAM,CAAC,KAAK,UAAU,UAAU,CAC9B,GAAY,EACZ,IAAsC;IAEtC,MAAM,MAAM,GAAG,cAAc,CAAC,GAAG,CAAC,CAAC;IACnC,MAAM,EAAE,UAAU,GAAG,MAAM,EAAE,GAAG,IAAI,CAAC;IAErC,MAAM,OAAO,GAAa,EAAE,CAAC;IAE7B,IAAI,UAAU,KAAK,OAAO,IAAI,UAAU,KAAK,MAAM,EAAE,CAAC;QACpD,IAAI,WAAW,CAAC,MAAM,CAAC,cAAc,CAAC,EAAE,CAAC;YACvC,OAAO,CAAC,IAAI,CAAC,gBAAgB,MAAM,CAAC,cAAc,EAAE,CAAC,CAAC;QACxD,CAAC;aAAM,CAAC;YACN,OAAO,CAAC,IAAI,CAAC,kCAAkC,CAAC,CAAC;QACnD,CAAC;IACH,CAAC;IAED,IAAI,UAAU,KAAK,UAAU,IAAI,UAAU,KAAK,MAAM,EAAE,CAAC;QACvD,IAAI,WAAW,CAAC,MAAM,CAAC,iBAAiB,CAAC,EAAE,CAAC;YAC1C,OAAO,CAAC,IAAI,CAAC,mBAAmB,MAAM,CAAC,iBAAiB,EAAE,CAAC,CAAC;QAC9D,CAAC;aAAM,CAAC;YACN,OAAO,CAAC,IAAI,CAAC,qCAAqC,CAAC,CAAC;QACtD,CAAC;IACH,CAAC;IAED,OAAO;QACL,OAAO,EAAE,IAAI;QACb,OAAO;QACP,OAAO,EAAE,uEAAuE;KACjF,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Channel tool handlers for Slack MCP Server
|
|
3
|
+
*/
|
|
4
|
+
import type { Request } from "express";
|
|
5
|
+
import type { z } from "zod";
|
|
6
|
+
import type { ChannelInfoSchema, ChannelMembersSchema, ChannelsListSchema, ChannelsDetailedSchema, SetChannelTopicSchema, SetChannelPurposeSchema } from "../schemas.js";
|
|
7
|
+
/**
|
|
8
|
+
* Get detailed information about a specific channel (cache-first approach)
|
|
9
|
+
*/
|
|
10
|
+
export declare function channelInfo(req: Request, args: z.infer<typeof ChannelInfoSchema>): Promise<{
|
|
11
|
+
success: boolean;
|
|
12
|
+
channel: import("../types.js").SlackChannel;
|
|
13
|
+
source: string;
|
|
14
|
+
cache_file: string;
|
|
15
|
+
note: string;
|
|
16
|
+
} | {
|
|
17
|
+
success: boolean;
|
|
18
|
+
channel: Record<string, unknown>;
|
|
19
|
+
source: string;
|
|
20
|
+
note: string;
|
|
21
|
+
cache_file?: undefined;
|
|
22
|
+
}>;
|
|
23
|
+
/**
|
|
24
|
+
* Get list of members in a channel with their details
|
|
25
|
+
*/
|
|
26
|
+
export declare function channelMembers(req: Request, args: z.infer<typeof ChannelMembersSchema>): Promise<{
|
|
27
|
+
success: boolean;
|
|
28
|
+
members: {
|
|
29
|
+
id: string;
|
|
30
|
+
username: string;
|
|
31
|
+
real_name: string;
|
|
32
|
+
display_name: string;
|
|
33
|
+
is_admin: boolean;
|
|
34
|
+
is_bot: boolean;
|
|
35
|
+
deleted: boolean;
|
|
36
|
+
}[];
|
|
37
|
+
member_count: number;
|
|
38
|
+
has_more: boolean;
|
|
39
|
+
next_cursor: string | undefined;
|
|
40
|
+
}>;
|
|
41
|
+
/**
|
|
42
|
+
* Get list of channels
|
|
43
|
+
*/
|
|
44
|
+
export declare function channelsList(req: Request, args: z.infer<typeof ChannelsListSchema>): Promise<{
|
|
45
|
+
success: boolean;
|
|
46
|
+
channels: Record<string, unknown>[];
|
|
47
|
+
next_cursor: string | undefined;
|
|
48
|
+
}>;
|
|
49
|
+
/**
|
|
50
|
+
* Get comprehensive list of channels with all details (EFFICIENT)
|
|
51
|
+
*/
|
|
52
|
+
export declare function channelsDetailed(req: Request, args: z.infer<typeof ChannelsDetailedSchema>): Promise<{
|
|
53
|
+
success: boolean;
|
|
54
|
+
channels: Record<string, unknown>[];
|
|
55
|
+
total_channels: number;
|
|
56
|
+
api_calls: number;
|
|
57
|
+
efficiency_note: string;
|
|
58
|
+
detailed_calls: number;
|
|
59
|
+
next_cursor: string | undefined;
|
|
60
|
+
performance: string;
|
|
61
|
+
}>;
|
|
62
|
+
/**
|
|
63
|
+
* Set the topic for a channel
|
|
64
|
+
*/
|
|
65
|
+
export declare function setChannelTopic(req: Request, args: z.infer<typeof SetChannelTopicSchema>): Promise<{
|
|
66
|
+
success: boolean;
|
|
67
|
+
topic: string;
|
|
68
|
+
}>;
|
|
69
|
+
/**
|
|
70
|
+
* Set the purpose for a channel
|
|
71
|
+
*/
|
|
72
|
+
export declare function setChannelPurpose(req: Request, args: z.infer<typeof SetChannelPurposeSchema>): Promise<{
|
|
73
|
+
success: boolean;
|
|
74
|
+
purpose: string;
|
|
75
|
+
}>;
|
|
76
|
+
//# sourceMappingURL=channels.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"channels.d.ts","sourceRoot":"","sources":["../../src/tools/channels.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AACvC,OAAO,KAAK,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAG7B,OAAO,KAAK,EACV,iBAAiB,EACjB,oBAAoB,EACpB,kBAAkB,EAClB,sBAAsB,EACtB,qBAAqB,EACrB,uBAAuB,EACxB,MAAM,eAAe,CAAC;AAEvB;;GAEG;AACH,wBAAsB,WAAW,CAC/B,GAAG,EAAE,OAAO,EACZ,IAAI,EAAE,CAAC,CAAC,KAAK,CAAC,OAAO,iBAAiB,CAAC;;;;;;;;;;;;GA0CxC;AAED;;GAEG;AACH,wBAAsB,cAAc,CAClC,GAAG,EAAE,OAAO,EACZ,IAAI,EAAE,CAAC,CAAC,KAAK,CAAC,OAAO,oBAAoB,CAAC;;;;;;;;;;;;;;GA2D3C;AAED;;GAEG;AACH,wBAAsB,YAAY,CAChC,GAAG,EAAE,OAAO,EACZ,IAAI,EAAE,CAAC,CAAC,KAAK,CAAC,OAAO,kBAAkB,CAAC;;;;GAoDzC;AAED;;GAEG;AACH,wBAAsB,gBAAgB,CACpC,GAAG,EAAE,OAAO,EACZ,IAAI,EAAE,CAAC,CAAC,KAAK,CAAC,OAAO,sBAAsB,CAAC;;;;;;;;;GAiH7C;AAED;;GAEG;AACH,wBAAsB,eAAe,CACnC,GAAG,EAAE,OAAO,EACZ,IAAI,EAAE,CAAC,CAAC,KAAK,CAAC,OAAO,qBAAqB,CAAC;;;GAoB5C;AAED;;GAEG;AACH,wBAAsB,iBAAiB,CACrC,GAAG,EAAE,OAAO,EACZ,IAAI,EAAE,CAAC,CAAC,KAAK,CAAC,OAAO,uBAAuB,CAAC;;;GAoB9C"}
|
|
@@ -0,0 +1,251 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Channel tool handlers for Slack MCP Server
|
|
3
|
+
*/
|
|
4
|
+
import { getSlackClient } from "../slack-api-client.js";
|
|
5
|
+
import { createUserLookup, extractUserDetails } from "../helpers.js";
|
|
6
|
+
/**
|
|
7
|
+
* Get detailed information about a specific channel (cache-first approach)
|
|
8
|
+
*/
|
|
9
|
+
export async function channelInfo(req, args) {
|
|
10
|
+
const client = getSlackClient(req);
|
|
11
|
+
const { channel_id, include_locale = false, use_cache = true } = args;
|
|
12
|
+
// Resolve channel name to ID
|
|
13
|
+
const resolvedChannelId = await client.resolveChannelId(channel_id);
|
|
14
|
+
// Try cache first if enabled
|
|
15
|
+
if (use_cache) {
|
|
16
|
+
try {
|
|
17
|
+
const channels = await client.getCachedChannels();
|
|
18
|
+
for (const channel of channels) {
|
|
19
|
+
if (channel.id === resolvedChannelId) {
|
|
20
|
+
return {
|
|
21
|
+
success: true,
|
|
22
|
+
channel,
|
|
23
|
+
source: "cache",
|
|
24
|
+
cache_file: client.channelsCacheFile,
|
|
25
|
+
note: "Data from cache. Set use_cache=false for fresh API data.",
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
catch {
|
|
31
|
+
// If cache fails, fall back to API
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
// Fall back to API call if cache miss or disabled
|
|
35
|
+
const data = await client.makeRequest("conversations.info", {
|
|
36
|
+
channel: resolvedChannelId,
|
|
37
|
+
include_locale,
|
|
38
|
+
});
|
|
39
|
+
return {
|
|
40
|
+
success: true,
|
|
41
|
+
channel: data.channel || {},
|
|
42
|
+
source: "api",
|
|
43
|
+
note: "Fresh data from Slack API",
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Get list of members in a channel with their details
|
|
48
|
+
*/
|
|
49
|
+
export async function channelMembers(req, args) {
|
|
50
|
+
const client = getSlackClient(req);
|
|
51
|
+
const { channel_id, limit = 100, cursor } = args;
|
|
52
|
+
// Resolve channel name to ID
|
|
53
|
+
const resolvedChannelId = await client.resolveChannelId(channel_id);
|
|
54
|
+
const params = {
|
|
55
|
+
channel: resolvedChannelId,
|
|
56
|
+
limit: Math.min(limit, 1000),
|
|
57
|
+
};
|
|
58
|
+
if (cursor) {
|
|
59
|
+
params.cursor = cursor;
|
|
60
|
+
}
|
|
61
|
+
const data = await client.makeRequest("conversations.members", params);
|
|
62
|
+
const memberIds = data.members || [];
|
|
63
|
+
// Get cached users for detailed information
|
|
64
|
+
const users = await client.getCachedUsers();
|
|
65
|
+
const userLookup = createUserLookup(users);
|
|
66
|
+
// Enrich member list with user details
|
|
67
|
+
const membersWithDetails = memberIds.map((memberId) => {
|
|
68
|
+
const userData = userLookup.get(memberId) || { id: memberId };
|
|
69
|
+
const typedUserData = userData;
|
|
70
|
+
return {
|
|
71
|
+
id: memberId,
|
|
72
|
+
username: typedUserData.name || "unknown",
|
|
73
|
+
real_name: typedUserData.real_name || "Unknown",
|
|
74
|
+
display_name: typedUserData.profile?.display_name || "",
|
|
75
|
+
is_admin: typedUserData.is_admin || false,
|
|
76
|
+
is_bot: typedUserData.is_bot || false,
|
|
77
|
+
deleted: typedUserData.deleted || false,
|
|
78
|
+
};
|
|
79
|
+
});
|
|
80
|
+
return {
|
|
81
|
+
success: true,
|
|
82
|
+
members: membersWithDetails,
|
|
83
|
+
member_count: membersWithDetails.length,
|
|
84
|
+
has_more: !!data.response_metadata?.next_cursor,
|
|
85
|
+
next_cursor: data.response_metadata?.next_cursor,
|
|
86
|
+
};
|
|
87
|
+
}
|
|
88
|
+
/**
|
|
89
|
+
* Get list of channels
|
|
90
|
+
*/
|
|
91
|
+
export async function channelsList(req, args) {
|
|
92
|
+
const client = getSlackClient(req);
|
|
93
|
+
const { channel_types, sort, limit = 100, cursor } = args;
|
|
94
|
+
// Validate channel types
|
|
95
|
+
const validTypes = new Set([
|
|
96
|
+
"mpim",
|
|
97
|
+
"im",
|
|
98
|
+
"public_channel",
|
|
99
|
+
"private_channel",
|
|
100
|
+
]);
|
|
101
|
+
const types = channel_types.split(",").map((t) => t.trim());
|
|
102
|
+
for (const t of types) {
|
|
103
|
+
if (!validTypes.has(t)) {
|
|
104
|
+
throw new Error(`Invalid channel type: ${t}. Valid types: ${Array.from(validTypes).join(", ")}`);
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
const params = {
|
|
108
|
+
types: channel_types,
|
|
109
|
+
limit: Math.min(Math.max(limit, 1), 999),
|
|
110
|
+
};
|
|
111
|
+
if (cursor) {
|
|
112
|
+
params.cursor = cursor;
|
|
113
|
+
}
|
|
114
|
+
const data = await client.makeRequest("conversations.list", params);
|
|
115
|
+
let channels = data.channels || [];
|
|
116
|
+
// Sort by popularity if requested
|
|
117
|
+
if (sort === "popularity") {
|
|
118
|
+
channels.sort((a, b) => {
|
|
119
|
+
const aMembers = a.num_members || 0;
|
|
120
|
+
const bMembers = b.num_members || 0;
|
|
121
|
+
return bMembers - aMembers;
|
|
122
|
+
});
|
|
123
|
+
}
|
|
124
|
+
return {
|
|
125
|
+
success: true,
|
|
126
|
+
channels,
|
|
127
|
+
next_cursor: data.response_metadata?.next_cursor,
|
|
128
|
+
};
|
|
129
|
+
}
|
|
130
|
+
/**
|
|
131
|
+
* Get comprehensive list of channels with all details (EFFICIENT)
|
|
132
|
+
*/
|
|
133
|
+
export async function channelsDetailed(req, args) {
|
|
134
|
+
const client = getSlackClient(req);
|
|
135
|
+
const { channel_types = "public_channel,private_channel", sort, limit = 100, include_detailed_info = false, } = args;
|
|
136
|
+
// Validate channel types
|
|
137
|
+
const validTypes = new Set([
|
|
138
|
+
"mpim",
|
|
139
|
+
"im",
|
|
140
|
+
"public_channel",
|
|
141
|
+
"private_channel",
|
|
142
|
+
]);
|
|
143
|
+
const types = channel_types.split(",").map((t) => t.trim());
|
|
144
|
+
for (const t of types) {
|
|
145
|
+
if (!validTypes.has(t)) {
|
|
146
|
+
throw new Error(`Invalid channel type: ${t}. Valid types: ${Array.from(validTypes).join(", ")}`);
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
const params = {
|
|
150
|
+
types: channel_types,
|
|
151
|
+
limit: Math.min(Math.max(limit, 1), 999),
|
|
152
|
+
};
|
|
153
|
+
// Single API call to get all channel data
|
|
154
|
+
const data = await client.makeRequest("conversations.list", params);
|
|
155
|
+
let channels = data.channels || [];
|
|
156
|
+
// Sort by popularity if requested
|
|
157
|
+
if (sort === "popularity") {
|
|
158
|
+
channels.sort((a, b) => {
|
|
159
|
+
const aMembers = a.num_members || 0;
|
|
160
|
+
const bMembers = b.num_members || 0;
|
|
161
|
+
return bMembers - aMembers;
|
|
162
|
+
});
|
|
163
|
+
}
|
|
164
|
+
// Enhance with cached user data for DMs
|
|
165
|
+
const cachedUsers = await client.getCachedUsers();
|
|
166
|
+
let usersCache = null;
|
|
167
|
+
try {
|
|
168
|
+
usersCache = createUserLookup(cachedUsers);
|
|
169
|
+
}
|
|
170
|
+
catch {
|
|
171
|
+
// Continue without user cache
|
|
172
|
+
}
|
|
173
|
+
// Process channels and add helpful information
|
|
174
|
+
const processedChannels = [];
|
|
175
|
+
let detailedCalls = 0;
|
|
176
|
+
for (const channel of channels) {
|
|
177
|
+
const processedChannel = { ...channel };
|
|
178
|
+
// Add user info for DMs
|
|
179
|
+
if (channel.is_im && channel.user && usersCache) {
|
|
180
|
+
const userId = channel.user;
|
|
181
|
+
if (usersCache.has(userId)) {
|
|
182
|
+
const userData = usersCache.get(userId);
|
|
183
|
+
processedChannel.user_info = extractUserDetails(userData);
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
// Add detailed info only if explicitly requested (makes extra API calls)
|
|
187
|
+
if (include_detailed_info && !channel.is_im) {
|
|
188
|
+
try {
|
|
189
|
+
const detailData = await client.makeRequest("conversations.info", { channel: channel.id });
|
|
190
|
+
const detailedInfo = detailData.channel || {};
|
|
191
|
+
// Merge additional details without overwriting existing data
|
|
192
|
+
for (const [key, value] of Object.entries(detailedInfo)) {
|
|
193
|
+
if (!(key in processedChannel) || !processedChannel[key]) {
|
|
194
|
+
processedChannel[key] = value;
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
processedChannel.detailed_source = "api";
|
|
198
|
+
detailedCalls++;
|
|
199
|
+
}
|
|
200
|
+
catch {
|
|
201
|
+
processedChannel.detailed_source = "unavailable";
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
processedChannels.push(processedChannel);
|
|
205
|
+
}
|
|
206
|
+
return {
|
|
207
|
+
success: true,
|
|
208
|
+
channels: processedChannels,
|
|
209
|
+
total_channels: processedChannels.length,
|
|
210
|
+
api_calls: 1 + detailedCalls,
|
|
211
|
+
efficiency_note: `Used 1 conversations.list call instead of ${processedChannels.length} individual channel_info calls`,
|
|
212
|
+
detailed_calls: include_detailed_info ? detailedCalls : 0,
|
|
213
|
+
next_cursor: data.response_metadata?.next_cursor,
|
|
214
|
+
performance: include_detailed_info ? "detailed_mode" : "optimized",
|
|
215
|
+
};
|
|
216
|
+
}
|
|
217
|
+
/**
|
|
218
|
+
* Set the topic for a channel
|
|
219
|
+
*/
|
|
220
|
+
export async function setChannelTopic(req, args) {
|
|
221
|
+
const client = getSlackClient(req);
|
|
222
|
+
const { channel_id, topic } = args;
|
|
223
|
+
// Resolve channel name to ID
|
|
224
|
+
const resolvedChannelId = await client.resolveChannelId(channel_id);
|
|
225
|
+
const data = await client.postRequest("conversations.setTopic", {
|
|
226
|
+
channel: resolvedChannelId,
|
|
227
|
+
topic,
|
|
228
|
+
});
|
|
229
|
+
return {
|
|
230
|
+
success: true,
|
|
231
|
+
topic: data.topic,
|
|
232
|
+
};
|
|
233
|
+
}
|
|
234
|
+
/**
|
|
235
|
+
* Set the purpose for a channel
|
|
236
|
+
*/
|
|
237
|
+
export async function setChannelPurpose(req, args) {
|
|
238
|
+
const client = getSlackClient(req);
|
|
239
|
+
const { channel_id, purpose } = args;
|
|
240
|
+
// Resolve channel name to ID
|
|
241
|
+
const resolvedChannelId = await client.resolveChannelId(channel_id);
|
|
242
|
+
const data = await client.postRequest("conversations.setPurpose", {
|
|
243
|
+
channel: resolvedChannelId,
|
|
244
|
+
purpose,
|
|
245
|
+
});
|
|
246
|
+
return {
|
|
247
|
+
success: true,
|
|
248
|
+
purpose: data.purpose,
|
|
249
|
+
};
|
|
250
|
+
}
|
|
251
|
+
//# sourceMappingURL=channels.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"channels.js","sourceRoot":"","sources":["../../src/tools/channels.ts"],"names":[],"mappings":"AAAA;;GAEG;AAIH,OAAO,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AACxD,OAAO,EAAE,gBAAgB,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAC;AAUrE;;GAEG;AACH,MAAM,CAAC,KAAK,UAAU,WAAW,CAC/B,GAAY,EACZ,IAAuC;IAEvC,MAAM,MAAM,GAAG,cAAc,CAAC,GAAG,CAAC,CAAC;IACnC,MAAM,EAAE,UAAU,EAAE,cAAc,GAAG,KAAK,EAAE,SAAS,GAAG,IAAI,EAAE,GAAG,IAAI,CAAC;IAEtE,6BAA6B;IAC7B,MAAM,iBAAiB,GAAG,MAAM,MAAM,CAAC,gBAAgB,CAAC,UAAU,CAAC,CA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+
*/
|
|
4
|
+
import type { Request } from "express";
|
|
5
|
+
import type { z } from "zod";
|
|
6
|
+
import type { ConversationsHistorySchema, ConversationsRepliesSchema, ConversationsAddMessageSchema, ConversationsSearchMessagesSchema, BulkConversationsHistorySchema } from "../schemas.js";
|
|
7
|
+
/**
|
|
8
|
+
* Get messages from a channel or DM with enhanced user information
|
|
9
|
+
*/
|
|
10
|
+
export declare function conversationsHistory(req: Request, args: z.infer<typeof ConversationsHistorySchema>): Promise<{
|
|
11
|
+
success: boolean;
|
|
12
|
+
messages: Record<string, unknown>[];
|
|
13
|
+
message_count: number;
|
|
14
|
+
has_more: boolean;
|
|
15
|
+
next_cursor: string | undefined;
|
|
16
|
+
channel_id: string;
|
|
17
|
+
}>;
|
|
18
|
+
/**
|
|
19
|
+
* Get thread replies for a conversation
|
|
20
|
+
*/
|
|
21
|
+
export declare function conversationsReplies(req: Request, args: z.infer<typeof ConversationsRepliesSchema>): Promise<{
|
|
22
|
+
success: boolean;
|
|
23
|
+
messages: Record<string, unknown>[];
|
|
24
|
+
has_more: boolean;
|
|
25
|
+
next_cursor: string | undefined;
|
|
26
|
+
}>;
|
|
27
|
+
/**
|
|
28
|
+
* Add a message to a channel or DM
|
|
29
|
+
*/
|
|
30
|
+
export declare function conversationsAddMessage(req: Request, args: z.infer<typeof ConversationsAddMessageSchema>): Promise<{
|
|
31
|
+
success: boolean;
|
|
32
|
+
message: Record<string, unknown>;
|
|
33
|
+
ts: string;
|
|
34
|
+
channel: string;
|
|
35
|
+
}>;
|
|
36
|
+
/**
|
|
37
|
+
* Search messages across Slack
|
|
38
|
+
*/
|
|
39
|
+
export declare function conversationsSearchMessages(req: Request, args: z.infer<typeof ConversationsSearchMessagesSchema>): Promise<{
|
|
40
|
+
success: boolean;
|
|
41
|
+
messages: Record<string, unknown>[];
|
|
42
|
+
total: number;
|
|
43
|
+
next_cursor: null;
|
|
44
|
+
} | {
|
|
45
|
+
success: boolean;
|
|
46
|
+
messages: Record<string, unknown>[];
|
|
47
|
+
total: number;
|
|
48
|
+
next_cursor: string | undefined;
|
|
49
|
+
}>;
|
|
50
|
+
/**
|
|
51
|
+
* Get messages from multiple channels efficiently
|
|
52
|
+
*/
|
|
53
|
+
export declare function bulkConversationsHistory(req: Request, args: z.infer<typeof BulkConversationsHistorySchema>): Promise<{
|
|
54
|
+
success: boolean;
|
|
55
|
+
channels: {
|
|
56
|
+
channel_id: string;
|
|
57
|
+
channel_input: string;
|
|
58
|
+
messages: Array<Record<string, unknown>>;
|
|
59
|
+
message_count: number;
|
|
60
|
+
success: boolean;
|
|
61
|
+
}[];
|
|
62
|
+
summary: {
|
|
63
|
+
total_channels: number;
|
|
64
|
+
successful_channels: number;
|
|
65
|
+
failed_channels: number;
|
|
66
|
+
total_messages: number;
|
|
67
|
+
api_calls: number;
|
|
68
|
+
filter_user: string | null;
|
|
69
|
+
filter_user_id: string | null;
|
|
70
|
+
};
|
|
71
|
+
failed_channels: {
|
|
72
|
+
channel_input: string;
|
|
73
|
+
error: string;
|
|
74
|
+
}[];
|
|
75
|
+
efficiency_note: string;
|
|
76
|
+
}>;
|
|
77
|
+
//# sourceMappingURL=conversations.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"conversations.d.ts","sourceRoot":"","sources":["../../src/tools/conversations.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AACvC,OAAO,KAAK,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAU7B,OAAO,KAAK,EACV,0BAA0B,EAC1B,0BAA0B,EAC1B,6BAA6B,EAC7B,iCAAiC,EACjC,8BAA8B,EAC/B,MAAM,eAAe,CAAC;AAEvB;;GAEG;AACH,wBAAsB,oBAAoB,CACxC,GAAG,EAAE,OAAO,EACZ,IAAI,EAAE,CAAC,CAAC,KAAK,CAAC,OAAO,0BAA0B,CAAC;;;;;;;GA+DjD;AAED;;GAEG;AACH,wBAAsB,oBAAoB,CACxC,GAAG,EAAE,OAAO,EACZ,IAAI,EAAE,CAAC,CAAC,KAAK,CAAC,OAAO,0BAA0B,CAAC;;;;;GAwCjD;AAED;;GAEG;AACH,wBAAsB,uBAAuB,CAC3C,GAAG,EAAE,OAAO,EACZ,IAAI,EAAE,CAAC,CAAC,KAAK,CAAC,OAAO,6BAA6B,CAAC;;;;;GAsCpD;AAED;;GAEG;AACH,wBAAsB,2BAA2B,CAC/C,GAAG,EAAE,OAAO,EACZ,IAAI,EAAE,CAAC,CAAC,KAAK,CAAC,OAAO,iCAAiC,CAAC;;;;;;;;;;GAgIxD;AAED;;GAEG;AACH,wBAAsB,wBAAwB,CAC5C,GAAG,EAAE,OAAO,EACZ,IAAI,EAAE,CAAC,CAAC,KAAK,CAAC,OAAO,8BAA8B,CAAC;;;oBAetC,MAAM;uBACH,MAAM;kBACX,KAAK,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;uBACzB,MAAM;iBACZ,OAAO;;;;;;;;;;;;uBAI2B,MAAM;eAAS,MAAM;;;GA+GnE"}
|