@mahesvara/discord-mcpserver 1.1.2 → 1.1.3

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.
@@ -43,7 +43,7 @@ export declare function truncateIfNeeded(text: string, limit?: number): string;
43
43
  /**
44
44
  * Format response based on format preference
45
45
  */
46
- export declare function formatResponse<T>(data: T, format: ResponseFormat, markdownFormatter: (item: T) => string): string;
46
+ export declare function formatResponse<T>(data: T | T[], format: ResponseFormat, markdownFormatter: (item: T) => string): string;
47
47
  export declare function guildToMarkdown(guild: DiscordGuild): string;
48
48
  export declare function channelToMarkdown(channel: DiscordChannel): string;
49
49
  export declare function memberToMarkdown(member: DiscordMember): string;
@@ -63,7 +63,7 @@ Returns:
63
63
  }
64
64
  }
65
65
  const formatted = filteredChannels.map(c => formatChannel(c));
66
- const text = formatResponse(formatted, params.response_format, (items) => items.map(channelToMarkdown).join("\n\n"));
66
+ const text = formatResponse(formatted, params.response_format, channelToMarkdown);
67
67
  return {
68
68
  content: [{ type: "text", text: truncateIfNeeded(text) }],
69
69
  };
@@ -41,7 +41,7 @@ Returns:
41
41
  roles: emoji.roles.cache.map(r => r.name),
42
42
  url: emoji.url,
43
43
  }));
44
- const result = formatResponse(emojis, params.response_format, (items) => items.map(e => `${e.animated ? '(animated) ' : ''}**${e.name}** - ID: ${e.id}`).join('\n'));
44
+ const result = formatResponse(emojis, params.response_format, (e) => `${e.animated ? '(animated) ' : ''}**${e.name}** - ID: ${e.id}`);
45
45
  return {
46
46
  content: [{ type: "text", text: truncateIfNeeded(result) }],
47
47
  };
@@ -185,7 +185,7 @@ Returns:
185
185
  available: sticker.available,
186
186
  url: sticker.url,
187
187
  }));
188
- const result = formatResponse(stickerList, params.response_format, (items) => items.map(s => `**${s.name}** (ID: ${s.id})\nDescription: ${s.description || 'None'}\nTags: ${s.tags || 'None'}`).join('\n\n'));
188
+ const result = formatResponse(stickerList, params.response_format, (s) => `**${s.name}** (ID: ${s.id})\nDescription: ${s.description || 'None'}\nTags: ${s.tags || 'None'}`);
189
189
  return {
190
190
  content: [{ type: "text", text: truncateIfNeeded(result) }],
191
191
  };
@@ -44,7 +44,7 @@ Returns:
44
44
  userCount: event.userCount,
45
45
  creator: event.creator?.username,
46
46
  }));
47
- const result = formatResponse(eventList, params.response_format, (items) => items.map(e => `**${e.name}** (ID: ${e.id})\nStatus: ${e.status}\nStart: ${e.scheduledStartTime}\nLocation: ${e.location || e.channel || 'TBD'}\nAttending: ${e.userCount || 0}`).join('\n\n'));
47
+ const result = formatResponse(eventList, params.response_format, (e) => `**${e.name}** (ID: ${e.id})\nStatus: ${e.status}\nStart: ${e.scheduledStartTime}\nLocation: ${e.location || e.channel || 'TBD'}\nAttending: ${e.userCount || 0}`);
48
48
  return {
49
49
  content: [{ type: "text", text: truncateIfNeeded(result) }],
50
50
  };
@@ -24,7 +24,7 @@ Returns:
24
24
  try {
25
25
  const client = await getClient();
26
26
  const guilds = client.guilds.cache.map(formatGuild);
27
- const text = formatResponse(guilds, params.response_format, (items) => items.map(guildToMarkdown).join("\n\n"));
27
+ const text = formatResponse(guilds, params.response_format, guildToMarkdown);
28
28
  return {
29
29
  content: [{ type: "text", text: truncateIfNeeded(text) }],
30
30
  };
@@ -42,7 +42,7 @@ Returns:
42
42
  createdAt: invite.createdAt?.toISOString(),
43
43
  expiresAt: invite.expiresAt?.toISOString() || 'Never',
44
44
  }));
45
- const result = formatResponse(inviteList, params.response_format, (items) => items.map(i => `**${i.code}** - #${i.channel}\nUses: ${i.uses}/${i.maxUses} | Expires: ${i.expiresAt}\nCreated by: ${i.inviter}`).join('\n\n'));
45
+ const result = formatResponse(inviteList, params.response_format, (i) => `**${i.code}** - #${i.channel}\nUses: ${i.uses}/${i.maxUses} | Expires: ${i.expiresAt}\nCreated by: ${i.inviter}`);
46
46
  return {
47
47
  content: [{ type: "text", text: truncateIfNeeded(result) }],
48
48
  };
@@ -38,7 +38,7 @@ Returns:
38
38
  // Convert Collection to array
39
39
  const membersArray = Array.from(membersResult.values());
40
40
  const formatted = membersArray.map((m) => formatMember(m));
41
- const text = formatResponse(formatted, params.response_format, (items) => items.map(memberToMarkdown).join("\n\n"));
41
+ const text = formatResponse(formatted, params.response_format, memberToMarkdown);
42
42
  return {
43
43
  content: [{ type: "text", text: truncateIfNeeded(text) }],
44
44
  };
@@ -82,7 +82,7 @@ Returns:
82
82
  options.after = params.after;
83
83
  const messages = await channel.messages.fetch(options);
84
84
  const formatted = messages.map((m) => formatMessage(m));
85
- const text = formatResponse(Array.from(formatted.values()), params.response_format, (items) => items.map(messageToMarkdown).join("\n\n---\n\n"));
85
+ const text = formatResponse(Array.from(formatted.values()), params.response_format, messageToMarkdown);
86
86
  return {
87
87
  content: [{ type: "text", text: truncateIfNeeded(text) }],
88
88
  };
@@ -214,7 +214,7 @@ Returns:
214
214
  username: ban.user.username,
215
215
  reason: ban.reason || 'No reason provided',
216
216
  }));
217
- const result = formatResponse(banList, params.response_format, (items) => items.map(b => `**${b.username}** (${b.userId})\nReason: ${b.reason}`).join('\n\n'));
217
+ const result = formatResponse(banList, params.response_format, (b) => `**${b.username}** (${b.userId})\nReason: ${b.reason}`);
218
218
  return {
219
219
  content: [{ type: "text", text: truncateIfNeeded(result) }],
220
220
  };
@@ -340,7 +340,7 @@ Returns:
340
340
  new: c.new,
341
341
  })),
342
342
  }));
343
- const result = formatResponse(entries, params.response_format, (items) => items.map(e => `**Action ${e.action}** by ${e.executor}\nTarget: ${e.target}\nReason: ${e.reason}\nTime: ${e.createdAt}`).join('\n\n'));
343
+ const result = formatResponse(entries, params.response_format, (e) => `**Action ${e.action}** by ${e.executor}\nTarget: ${e.target}\nReason: ${e.reason}\nTime: ${e.createdAt}`);
344
344
  return {
345
345
  content: [{ type: "text", text: truncateIfNeeded(result) }],
346
346
  };
@@ -388,7 +388,7 @@ Returns:
388
388
  triggerType: rule.triggerType,
389
389
  actions: rule.actions.map(a => ({ type: a.type, metadata: a.metadata })),
390
390
  }));
391
- const text = formatResponse(ruleList, params.response_format, (items) => items.map(r => `**${r.name}** (${r.id})\nEnabled: ${r.enabled}\nTrigger: ${r.triggerType}\nActions: ${r.actions.map(a => a.type).join(', ')}`).join('\n\n'));
391
+ const text = formatResponse(ruleList, params.response_format, (r) => `**${r.name}** (${r.id})\nEnabled: ${r.enabled}\nTrigger: ${r.triggerType}\nActions: ${r.actions.map(a => a.type).join(', ')}`);
392
392
  return {
393
393
  content: [{ type: "text", text: truncateIfNeeded(text) }],
394
394
  };
@@ -54,7 +54,7 @@ Returns:
54
54
  .filter(r => r.name !== "@everyone")
55
55
  .sort((a, b) => b.position - a.position)
56
56
  .map(formatRole);
57
- const text = formatResponse(Array.from(roles.values()), params.response_format, (items) => items.map(roleToMarkdown).join("\n\n"));
57
+ const text = formatResponse(Array.from(roles.values()), params.response_format, roleToMarkdown);
58
58
  return {
59
59
  content: [{ type: "text", text: truncateIfNeeded(text) }],
60
60
  };
@@ -57,7 +57,7 @@ Returns:
57
57
  owner: wh.owner?.username || 'Unknown',
58
58
  avatar: wh.avatarURL(),
59
59
  }));
60
- const result = formatResponse(webhookList, params.response_format, (items) => items.map(w => `**${w.name}** (ID: ${w.id})\nChannel: <#${w.channel}>\nOwner: ${w.owner}`).join('\n\n'));
60
+ const result = formatResponse(webhookList, params.response_format, (w) => `**${w.name}** (ID: ${w.id})\nChannel: <#${w.channel}>\nOwner: ${w.owner}`);
61
61
  return {
62
62
  content: [{ type: "text", text: truncateIfNeeded(result) }],
63
63
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mahesvara/discord-mcpserver",
3
- "version": "1.1.2",
3
+ "version": "1.1.3",
4
4
  "description": "MCP server for controlling Discord servers via bot token",
5
5
  "author": "Mahesvara",
6
6
  "repository": {