chore: import upstream snapshot with attribution
Publish CLI Package / publish-npm (push) Waiting to run
Publish Python SDK / publish-pypi (push) Waiting to run
Publish TypeScript SDK / publish-npm (push) Waiting to run
CI / Migrate Dev DB (push) Has been skipped
CI / Detect Version (push) Has been cancelled
CI / Migrate DB (push) Has been cancelled
CI / Build Dev ECR (./docker/app.Dockerfile, ECR_APP) (push) Has been cancelled
CI / Build Dev ECR (./docker/db.Dockerfile, ECR_MIGRATIONS) (push) Has been cancelled
CI / Build Dev ECR (./docker/pii.Dockerfile, ECR_PII) (push) Has been cancelled
CI / Build Dev ECR (./docker/realtime.Dockerfile, ECR_REALTIME) (push) Has been cancelled
CI / Deploy Trigger.dev (Dev) (push) Has been cancelled
CI / Build AMD64 (./docker/app.Dockerfile, ECR_APP, ghcr.io/simstudioai/simstudio) (push) Has been cancelled
CI / Build AMD64 (./docker/db.Dockerfile, ECR_MIGRATIONS, ghcr.io/simstudioai/migrations) (push) Has been cancelled
CI / Build AMD64 (./docker/pii.Dockerfile, ECR_PII, ghcr.io/simstudioai/pii) (push) Has been cancelled
CI / Build AMD64 (./docker/realtime.Dockerfile, ECR_REALTIME, ghcr.io/simstudioai/realtime) (push) Has been cancelled
CI / Build ARM64 (GHCR Only) (./docker/app.Dockerfile, ghcr.io/simstudioai/simstudio) (push) Has been cancelled
CI / Build ARM64 (GHCR Only) (./docker/db.Dockerfile, ghcr.io/simstudioai/migrations) (push) Has been cancelled
CI / Build ARM64 (GHCR Only) (./docker/pii.Dockerfile, ghcr.io/simstudioai/pii) (push) Has been cancelled
CI / Build ARM64 (GHCR Only) (./docker/realtime.Dockerfile, ghcr.io/simstudioai/realtime) (push) Has been cancelled
CI / Create GHCR Manifests (ghcr.io/simstudioai/migrations) (push) Has been cancelled
CI / Create GHCR Manifests (ghcr.io/simstudioai/pii) (push) Has been cancelled
CI / Create GHCR Manifests (ghcr.io/simstudioai/realtime) (push) Has been cancelled
CI / Create GHCR Manifests (ghcr.io/simstudioai/simstudio) (push) Has been cancelled
CI / Check Docs Changes (push) Has been cancelled
CI / Process Docs (push) Has been cancelled
CI / Create GitHub Release (push) Has been cancelled
CI / Test and Build (push) Has been cancelled
Publish CLI Package / publish-npm (push) Waiting to run
Publish Python SDK / publish-pypi (push) Waiting to run
Publish TypeScript SDK / publish-npm (push) Waiting to run
CI / Migrate Dev DB (push) Has been skipped
CI / Detect Version (push) Has been cancelled
CI / Migrate DB (push) Has been cancelled
CI / Build Dev ECR (./docker/app.Dockerfile, ECR_APP) (push) Has been cancelled
CI / Build Dev ECR (./docker/db.Dockerfile, ECR_MIGRATIONS) (push) Has been cancelled
CI / Build Dev ECR (./docker/pii.Dockerfile, ECR_PII) (push) Has been cancelled
CI / Build Dev ECR (./docker/realtime.Dockerfile, ECR_REALTIME) (push) Has been cancelled
CI / Deploy Trigger.dev (Dev) (push) Has been cancelled
CI / Build AMD64 (./docker/app.Dockerfile, ECR_APP, ghcr.io/simstudioai/simstudio) (push) Has been cancelled
CI / Build AMD64 (./docker/db.Dockerfile, ECR_MIGRATIONS, ghcr.io/simstudioai/migrations) (push) Has been cancelled
CI / Build AMD64 (./docker/pii.Dockerfile, ECR_PII, ghcr.io/simstudioai/pii) (push) Has been cancelled
CI / Build AMD64 (./docker/realtime.Dockerfile, ECR_REALTIME, ghcr.io/simstudioai/realtime) (push) Has been cancelled
CI / Build ARM64 (GHCR Only) (./docker/app.Dockerfile, ghcr.io/simstudioai/simstudio) (push) Has been cancelled
CI / Build ARM64 (GHCR Only) (./docker/db.Dockerfile, ghcr.io/simstudioai/migrations) (push) Has been cancelled
CI / Build ARM64 (GHCR Only) (./docker/pii.Dockerfile, ghcr.io/simstudioai/pii) (push) Has been cancelled
CI / Build ARM64 (GHCR Only) (./docker/realtime.Dockerfile, ghcr.io/simstudioai/realtime) (push) Has been cancelled
CI / Create GHCR Manifests (ghcr.io/simstudioai/migrations) (push) Has been cancelled
CI / Create GHCR Manifests (ghcr.io/simstudioai/pii) (push) Has been cancelled
CI / Create GHCR Manifests (ghcr.io/simstudioai/realtime) (push) Has been cancelled
CI / Create GHCR Manifests (ghcr.io/simstudioai/simstudio) (push) Has been cancelled
CI / Check Docs Changes (push) Has been cancelled
CI / Process Docs (push) Has been cancelled
CI / Create GitHub Release (push) Has been cancelled
CI / Test and Build (push) Has been cancelled
This commit is contained in:
@@ -0,0 +1,69 @@
|
||||
import type { DiscordAddReactionParams, DiscordAddReactionResponse } from '@/tools/discord/types'
|
||||
import type { ToolConfig } from '@/tools/types'
|
||||
|
||||
export const discordAddReactionTool: ToolConfig<
|
||||
DiscordAddReactionParams,
|
||||
DiscordAddReactionResponse
|
||||
> = {
|
||||
id: 'discord_add_reaction',
|
||||
name: 'Discord Add Reaction',
|
||||
description: 'Add a reaction emoji to a Discord message',
|
||||
version: '1.0.0',
|
||||
|
||||
params: {
|
||||
botToken: {
|
||||
type: 'string',
|
||||
required: true,
|
||||
visibility: 'user-only',
|
||||
description: 'The bot token for authentication',
|
||||
},
|
||||
channelId: {
|
||||
type: 'string',
|
||||
required: true,
|
||||
visibility: 'user-or-llm',
|
||||
description: 'The Discord channel ID containing the message, e.g., 123456789012345678',
|
||||
},
|
||||
messageId: {
|
||||
type: 'string',
|
||||
required: true,
|
||||
visibility: 'user-or-llm',
|
||||
description: 'The ID of the message to react to, e.g., 123456789012345678',
|
||||
},
|
||||
emoji: {
|
||||
type: 'string',
|
||||
required: true,
|
||||
visibility: 'user-or-llm',
|
||||
description: 'The emoji to react with (unicode emoji or custom emoji in name:id format)',
|
||||
},
|
||||
serverId: {
|
||||
type: 'string',
|
||||
required: true,
|
||||
visibility: 'user-or-llm',
|
||||
description: 'The Discord server ID (guild ID), e.g., 123456789012345678',
|
||||
},
|
||||
},
|
||||
|
||||
request: {
|
||||
url: (params: DiscordAddReactionParams) => {
|
||||
const encodedEmoji = encodeURIComponent(params.emoji)
|
||||
return `https://discord.com/api/v10/channels/${params.channelId.trim()}/messages/${params.messageId.trim()}/reactions/${encodedEmoji}/@me`
|
||||
},
|
||||
method: 'PUT',
|
||||
headers: (params) => ({
|
||||
Authorization: `Bot ${params.botToken.trim()}`,
|
||||
}),
|
||||
},
|
||||
|
||||
transformResponse: async (response) => {
|
||||
return {
|
||||
success: true,
|
||||
output: {
|
||||
message: 'Reaction added successfully',
|
||||
},
|
||||
}
|
||||
},
|
||||
|
||||
outputs: {
|
||||
message: { type: 'string', description: 'Success or error message' },
|
||||
},
|
||||
}
|
||||
@@ -0,0 +1,81 @@
|
||||
import type {
|
||||
DiscordArchiveThreadParams,
|
||||
DiscordArchiveThreadResponse,
|
||||
} from '@/tools/discord/types'
|
||||
import type { ToolConfig } from '@/tools/types'
|
||||
|
||||
export const discordArchiveThreadTool: ToolConfig<
|
||||
DiscordArchiveThreadParams,
|
||||
DiscordArchiveThreadResponse
|
||||
> = {
|
||||
id: 'discord_archive_thread',
|
||||
name: 'Discord Archive Thread',
|
||||
description: 'Archive or unarchive a thread in Discord',
|
||||
version: '1.0.0',
|
||||
|
||||
params: {
|
||||
botToken: {
|
||||
type: 'string',
|
||||
required: true,
|
||||
visibility: 'user-only',
|
||||
description: 'The bot token for authentication',
|
||||
},
|
||||
threadId: {
|
||||
type: 'string',
|
||||
required: true,
|
||||
visibility: 'user-or-llm',
|
||||
description: 'The thread ID to archive/unarchive, e.g., 123456789012345678',
|
||||
},
|
||||
archived: {
|
||||
type: 'boolean',
|
||||
required: true,
|
||||
visibility: 'user-or-llm',
|
||||
description: 'Whether to archive (true) or unarchive (false) the thread',
|
||||
},
|
||||
serverId: {
|
||||
type: 'string',
|
||||
required: true,
|
||||
visibility: 'user-or-llm',
|
||||
description: 'The Discord server ID (guild ID), e.g., 123456789012345678',
|
||||
},
|
||||
},
|
||||
|
||||
request: {
|
||||
url: (params: DiscordArchiveThreadParams) => {
|
||||
return `https://discord.com/api/v10/channels/${params.threadId.trim()}`
|
||||
},
|
||||
method: 'PATCH',
|
||||
headers: (params) => ({
|
||||
'Content-Type': 'application/json',
|
||||
Authorization: `Bot ${params.botToken.trim()}`,
|
||||
}),
|
||||
body: (params: DiscordArchiveThreadParams) => {
|
||||
return {
|
||||
archived: params.archived,
|
||||
}
|
||||
},
|
||||
},
|
||||
|
||||
transformResponse: async (response) => {
|
||||
const data = await response.json()
|
||||
return {
|
||||
success: true,
|
||||
output: {
|
||||
message: data.archived ? 'Thread archived successfully' : 'Thread unarchived successfully',
|
||||
data,
|
||||
},
|
||||
}
|
||||
},
|
||||
|
||||
outputs: {
|
||||
message: { type: 'string', description: 'Success or error message' },
|
||||
data: {
|
||||
type: 'object',
|
||||
description: 'Updated thread data',
|
||||
properties: {
|
||||
id: { type: 'string', description: 'Thread ID' },
|
||||
archived: { type: 'boolean', description: 'Whether thread is archived' },
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
@@ -0,0 +1,60 @@
|
||||
import type { DiscordAssignRoleParams, DiscordAssignRoleResponse } from '@/tools/discord/types'
|
||||
import type { ToolConfig } from '@/tools/types'
|
||||
|
||||
export const discordAssignRoleTool: ToolConfig<DiscordAssignRoleParams, DiscordAssignRoleResponse> =
|
||||
{
|
||||
id: 'discord_assign_role',
|
||||
name: 'Discord Assign Role',
|
||||
description: 'Assign a role to a member in a Discord server',
|
||||
version: '1.0.0',
|
||||
|
||||
params: {
|
||||
botToken: {
|
||||
type: 'string',
|
||||
required: true,
|
||||
visibility: 'user-only',
|
||||
description: 'The bot token for authentication',
|
||||
},
|
||||
serverId: {
|
||||
type: 'string',
|
||||
required: true,
|
||||
visibility: 'user-or-llm',
|
||||
description: 'The Discord server ID (guild ID), e.g., 123456789012345678',
|
||||
},
|
||||
userId: {
|
||||
type: 'string',
|
||||
required: true,
|
||||
visibility: 'user-or-llm',
|
||||
description: 'The user ID to assign the role to, e.g., 123456789012345678',
|
||||
},
|
||||
roleId: {
|
||||
type: 'string',
|
||||
required: true,
|
||||
visibility: 'user-or-llm',
|
||||
description: 'The role ID to assign, e.g., 123456789012345678',
|
||||
},
|
||||
},
|
||||
|
||||
request: {
|
||||
url: (params: DiscordAssignRoleParams) => {
|
||||
return `https://discord.com/api/v10/guilds/${params.serverId.trim()}/members/${params.userId.trim()}/roles/${params.roleId.trim()}`
|
||||
},
|
||||
method: 'PUT',
|
||||
headers: (params) => ({
|
||||
Authorization: `Bot ${params.botToken.trim()}`,
|
||||
}),
|
||||
},
|
||||
|
||||
transformResponse: async (response) => {
|
||||
return {
|
||||
success: true,
|
||||
output: {
|
||||
message: 'Role assigned successfully',
|
||||
},
|
||||
}
|
||||
},
|
||||
|
||||
outputs: {
|
||||
message: { type: 'string', description: 'Success or error message' },
|
||||
},
|
||||
}
|
||||
@@ -0,0 +1,79 @@
|
||||
import type { DiscordBanMemberParams, DiscordBanMemberResponse } from '@/tools/discord/types'
|
||||
import type { ToolConfig } from '@/tools/types'
|
||||
|
||||
export const discordBanMemberTool: ToolConfig<DiscordBanMemberParams, DiscordBanMemberResponse> = {
|
||||
id: 'discord_ban_member',
|
||||
name: 'Discord Ban Member',
|
||||
description: 'Ban a member from a Discord server',
|
||||
version: '1.0.0',
|
||||
|
||||
params: {
|
||||
botToken: {
|
||||
type: 'string',
|
||||
required: true,
|
||||
visibility: 'user-only',
|
||||
description: 'The bot token for authentication',
|
||||
},
|
||||
serverId: {
|
||||
type: 'string',
|
||||
required: true,
|
||||
visibility: 'user-or-llm',
|
||||
description: 'The Discord server ID (guild ID), e.g., 123456789012345678',
|
||||
},
|
||||
userId: {
|
||||
type: 'string',
|
||||
required: true,
|
||||
visibility: 'user-or-llm',
|
||||
description: 'The user ID to ban, e.g., 123456789012345678',
|
||||
},
|
||||
reason: {
|
||||
type: 'string',
|
||||
required: false,
|
||||
visibility: 'user-or-llm',
|
||||
description: 'Reason for banning the member',
|
||||
},
|
||||
deleteMessageSeconds: {
|
||||
type: 'number',
|
||||
required: false,
|
||||
visibility: 'user-or-llm',
|
||||
description: 'Seconds of message history to delete, 0-604800 (7 days)',
|
||||
},
|
||||
},
|
||||
|
||||
request: {
|
||||
url: (params: DiscordBanMemberParams) => {
|
||||
return `https://discord.com/api/v10/guilds/${params.serverId.trim()}/bans/${params.userId.trim()}`
|
||||
},
|
||||
method: 'PUT',
|
||||
headers: (params) => {
|
||||
const headers: Record<string, string> = {
|
||||
'Content-Type': 'application/json',
|
||||
Authorization: `Bot ${params.botToken.trim()}`,
|
||||
}
|
||||
if (params.reason) {
|
||||
headers['X-Audit-Log-Reason'] = encodeURIComponent(params.reason)
|
||||
}
|
||||
return headers
|
||||
},
|
||||
body: (params: DiscordBanMemberParams) => {
|
||||
const body: any = {}
|
||||
if (params.deleteMessageSeconds !== undefined) {
|
||||
body.delete_message_seconds = Number(params.deleteMessageSeconds)
|
||||
}
|
||||
return body
|
||||
},
|
||||
},
|
||||
|
||||
transformResponse: async (response) => {
|
||||
return {
|
||||
success: true,
|
||||
output: {
|
||||
message: 'Member banned successfully',
|
||||
},
|
||||
}
|
||||
},
|
||||
|
||||
outputs: {
|
||||
message: { type: 'string', description: 'Success or error message' },
|
||||
},
|
||||
}
|
||||
@@ -0,0 +1,78 @@
|
||||
import type {
|
||||
DiscordBulkDeleteMessagesParams,
|
||||
DiscordBulkDeleteMessagesResponse,
|
||||
} from '@/tools/discord/types'
|
||||
import type { ToolConfig } from '@/tools/types'
|
||||
|
||||
export const discordBulkDeleteMessagesTool: ToolConfig<
|
||||
DiscordBulkDeleteMessagesParams,
|
||||
DiscordBulkDeleteMessagesResponse
|
||||
> = {
|
||||
id: 'discord_bulk_delete_messages',
|
||||
name: 'Discord Bulk Delete Messages',
|
||||
description: 'Delete 2-100 messages from a Discord channel in a single request',
|
||||
version: '1.0.0',
|
||||
|
||||
params: {
|
||||
botToken: {
|
||||
type: 'string',
|
||||
required: true,
|
||||
visibility: 'user-only',
|
||||
description: 'The bot token for authentication',
|
||||
},
|
||||
channelId: {
|
||||
type: 'string',
|
||||
required: true,
|
||||
visibility: 'user-or-llm',
|
||||
description: 'The Discord channel ID to delete messages from, e.g., 123456789012345678',
|
||||
},
|
||||
messageIds: {
|
||||
type: 'json',
|
||||
required: true,
|
||||
visibility: 'user-or-llm',
|
||||
description:
|
||||
'Array of 2-100 message IDs to delete. Messages older than 2 weeks cannot be bulk deleted.',
|
||||
},
|
||||
serverId: {
|
||||
type: 'string',
|
||||
required: true,
|
||||
visibility: 'user-or-llm',
|
||||
description: 'The Discord server ID (guild ID), e.g., 123456789012345678',
|
||||
},
|
||||
},
|
||||
|
||||
request: {
|
||||
url: (params: DiscordBulkDeleteMessagesParams) => {
|
||||
return `https://discord.com/api/v10/channels/${params.channelId.trim()}/messages/bulk-delete`
|
||||
},
|
||||
method: 'POST',
|
||||
headers: (params) => ({
|
||||
'Content-Type': 'application/json',
|
||||
Authorization: `Bot ${params.botToken.trim()}`,
|
||||
}),
|
||||
body: (params: DiscordBulkDeleteMessagesParams) => {
|
||||
const messages = (Array.isArray(params.messageIds) ? params.messageIds : [params.messageIds])
|
||||
.map((id) => String(id).trim())
|
||||
.filter(Boolean)
|
||||
if (messages.length < 2 || messages.length > 100) {
|
||||
throw new Error(
|
||||
`Discord requires 2-100 message IDs for bulk delete, got ${messages.length}`
|
||||
)
|
||||
}
|
||||
return { messages }
|
||||
},
|
||||
},
|
||||
|
||||
transformResponse: async () => {
|
||||
return {
|
||||
success: true,
|
||||
output: {
|
||||
message: 'Messages deleted successfully',
|
||||
},
|
||||
}
|
||||
},
|
||||
|
||||
outputs: {
|
||||
message: { type: 'string', description: 'Success or error message' },
|
||||
},
|
||||
}
|
||||
@@ -0,0 +1,99 @@
|
||||
import type {
|
||||
DiscordCreateChannelParams,
|
||||
DiscordCreateChannelResponse,
|
||||
} from '@/tools/discord/types'
|
||||
import type { ToolConfig } from '@/tools/types'
|
||||
|
||||
export const discordCreateChannelTool: ToolConfig<
|
||||
DiscordCreateChannelParams,
|
||||
DiscordCreateChannelResponse
|
||||
> = {
|
||||
id: 'discord_create_channel',
|
||||
name: 'Discord Create Channel',
|
||||
description: 'Create a new channel in a Discord server',
|
||||
version: '1.0.0',
|
||||
|
||||
params: {
|
||||
botToken: {
|
||||
type: 'string',
|
||||
required: true,
|
||||
visibility: 'user-only',
|
||||
description: 'The bot token for authentication',
|
||||
},
|
||||
serverId: {
|
||||
type: 'string',
|
||||
required: true,
|
||||
visibility: 'user-or-llm',
|
||||
description: 'The Discord server ID (guild ID), e.g., 123456789012345678',
|
||||
},
|
||||
name: {
|
||||
type: 'string',
|
||||
required: true,
|
||||
visibility: 'user-or-llm',
|
||||
description: 'The name of the channel (1-100 characters)',
|
||||
},
|
||||
type: {
|
||||
type: 'number',
|
||||
required: false,
|
||||
visibility: 'user-or-llm',
|
||||
description: 'Channel type (0=text, 2=voice, 4=category, 5=announcement, 13=stage)',
|
||||
},
|
||||
topic: {
|
||||
type: 'string',
|
||||
required: false,
|
||||
visibility: 'user-or-llm',
|
||||
description: 'Channel topic (0-1024 characters)',
|
||||
},
|
||||
parentId: {
|
||||
type: 'string',
|
||||
required: false,
|
||||
visibility: 'user-or-llm',
|
||||
description: 'Parent category ID for the channel, e.g., 123456789012345678',
|
||||
},
|
||||
},
|
||||
|
||||
request: {
|
||||
url: (params: DiscordCreateChannelParams) => {
|
||||
return `https://discord.com/api/v10/guilds/${params.serverId.trim()}/channels`
|
||||
},
|
||||
method: 'POST',
|
||||
headers: (params) => ({
|
||||
'Content-Type': 'application/json',
|
||||
Authorization: `Bot ${params.botToken.trim()}`,
|
||||
}),
|
||||
body: (params: DiscordCreateChannelParams) => {
|
||||
const body: any = {
|
||||
name: params.name,
|
||||
}
|
||||
if (params.type !== undefined) body.type = Number(params.type)
|
||||
if (params.topic) body.topic = params.topic
|
||||
if (params.parentId) body.parent_id = params.parentId
|
||||
return body
|
||||
},
|
||||
},
|
||||
|
||||
transformResponse: async (response) => {
|
||||
const data = await response.json()
|
||||
return {
|
||||
success: true,
|
||||
output: {
|
||||
message: 'Channel created successfully',
|
||||
data,
|
||||
},
|
||||
}
|
||||
},
|
||||
|
||||
outputs: {
|
||||
message: { type: 'string', description: 'Success or error message' },
|
||||
data: {
|
||||
type: 'object',
|
||||
description: 'Created channel data',
|
||||
properties: {
|
||||
id: { type: 'string', description: 'Channel ID' },
|
||||
name: { type: 'string', description: 'Channel name' },
|
||||
type: { type: 'number', description: 'Channel type' },
|
||||
guild_id: { type: 'string', description: 'Server ID' },
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
@@ -0,0 +1,95 @@
|
||||
import type { DiscordCreateInviteParams, DiscordCreateInviteResponse } from '@/tools/discord/types'
|
||||
import type { ToolConfig } from '@/tools/types'
|
||||
|
||||
export const discordCreateInviteTool: ToolConfig<
|
||||
DiscordCreateInviteParams,
|
||||
DiscordCreateInviteResponse
|
||||
> = {
|
||||
id: 'discord_create_invite',
|
||||
name: 'Discord Create Invite',
|
||||
description: 'Create an invite link for a Discord channel',
|
||||
version: '1.0.0',
|
||||
|
||||
params: {
|
||||
botToken: {
|
||||
type: 'string',
|
||||
required: true,
|
||||
visibility: 'user-only',
|
||||
description: 'The bot token for authentication',
|
||||
},
|
||||
channelId: {
|
||||
type: 'string',
|
||||
required: true,
|
||||
visibility: 'user-or-llm',
|
||||
description: 'The Discord channel ID to create an invite for, e.g., 123456789012345678',
|
||||
},
|
||||
maxAge: {
|
||||
type: 'number',
|
||||
required: false,
|
||||
visibility: 'user-or-llm',
|
||||
description: 'Duration of invite in seconds (0 = never expires, default 86400)',
|
||||
},
|
||||
maxUses: {
|
||||
type: 'number',
|
||||
required: false,
|
||||
visibility: 'user-or-llm',
|
||||
description: 'Max number of uses (0 = unlimited, default 0)',
|
||||
},
|
||||
temporary: {
|
||||
type: 'boolean',
|
||||
required: false,
|
||||
visibility: 'user-or-llm',
|
||||
description: 'Whether invite grants temporary membership',
|
||||
},
|
||||
serverId: {
|
||||
type: 'string',
|
||||
required: true,
|
||||
visibility: 'user-or-llm',
|
||||
description: 'The Discord server ID (guild ID), e.g., 123456789012345678',
|
||||
},
|
||||
},
|
||||
|
||||
request: {
|
||||
url: (params: DiscordCreateInviteParams) => {
|
||||
return `https://discord.com/api/v10/channels/${params.channelId.trim()}/invites`
|
||||
},
|
||||
method: 'POST',
|
||||
headers: (params) => ({
|
||||
'Content-Type': 'application/json',
|
||||
Authorization: `Bot ${params.botToken.trim()}`,
|
||||
}),
|
||||
body: (params: DiscordCreateInviteParams) => {
|
||||
const body: any = {}
|
||||
if (params.maxAge !== undefined) body.max_age = Number(params.maxAge)
|
||||
if (params.maxUses !== undefined) body.max_uses = Number(params.maxUses)
|
||||
if (params.temporary !== undefined) body.temporary = params.temporary
|
||||
return body
|
||||
},
|
||||
},
|
||||
|
||||
transformResponse: async (response) => {
|
||||
const data = await response.json()
|
||||
return {
|
||||
success: true,
|
||||
output: {
|
||||
message: 'Invite created successfully',
|
||||
data,
|
||||
},
|
||||
}
|
||||
},
|
||||
|
||||
outputs: {
|
||||
message: { type: 'string', description: 'Success or error message' },
|
||||
data: {
|
||||
type: 'object',
|
||||
description: 'Created invite data',
|
||||
properties: {
|
||||
code: { type: 'string', description: 'Invite code' },
|
||||
url: { type: 'string', description: 'Full invite URL' },
|
||||
max_age: { type: 'number', description: 'Max age in seconds' },
|
||||
max_uses: { type: 'number', description: 'Max uses' },
|
||||
temporary: { type: 'boolean', description: 'Whether temporary' },
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
@@ -0,0 +1,95 @@
|
||||
import type { DiscordCreateRoleParams, DiscordCreateRoleResponse } from '@/tools/discord/types'
|
||||
import type { ToolConfig } from '@/tools/types'
|
||||
|
||||
export const discordCreateRoleTool: ToolConfig<DiscordCreateRoleParams, DiscordCreateRoleResponse> =
|
||||
{
|
||||
id: 'discord_create_role',
|
||||
name: 'Discord Create Role',
|
||||
description: 'Create a new role in a Discord server',
|
||||
version: '1.0.0',
|
||||
|
||||
params: {
|
||||
botToken: {
|
||||
type: 'string',
|
||||
required: true,
|
||||
visibility: 'user-only',
|
||||
description: 'The bot token for authentication',
|
||||
},
|
||||
serverId: {
|
||||
type: 'string',
|
||||
required: true,
|
||||
visibility: 'user-or-llm',
|
||||
description: 'The Discord server ID (guild ID), e.g., 123456789012345678',
|
||||
},
|
||||
name: {
|
||||
type: 'string',
|
||||
required: true,
|
||||
visibility: 'user-or-llm',
|
||||
description: 'The name of the role',
|
||||
},
|
||||
color: {
|
||||
type: 'number',
|
||||
required: false,
|
||||
visibility: 'user-or-llm',
|
||||
description: 'RGB color value as integer (e.g., 0xFF0000 for red)',
|
||||
},
|
||||
hoist: {
|
||||
type: 'boolean',
|
||||
required: false,
|
||||
visibility: 'user-or-llm',
|
||||
description: 'Whether to display role members separately from online members',
|
||||
},
|
||||
mentionable: {
|
||||
type: 'boolean',
|
||||
required: false,
|
||||
visibility: 'user-or-llm',
|
||||
description: 'Whether the role can be mentioned',
|
||||
},
|
||||
},
|
||||
|
||||
request: {
|
||||
url: (params: DiscordCreateRoleParams) => {
|
||||
return `https://discord.com/api/v10/guilds/${params.serverId.trim()}/roles`
|
||||
},
|
||||
method: 'POST',
|
||||
headers: (params) => ({
|
||||
'Content-Type': 'application/json',
|
||||
Authorization: `Bot ${params.botToken.trim()}`,
|
||||
}),
|
||||
body: (params: DiscordCreateRoleParams) => {
|
||||
const body: any = {
|
||||
name: params.name,
|
||||
}
|
||||
if (params.color !== undefined) body.color = Number(params.color)
|
||||
if (params.hoist !== undefined) body.hoist = params.hoist
|
||||
if (params.mentionable !== undefined) body.mentionable = params.mentionable
|
||||
return body
|
||||
},
|
||||
},
|
||||
|
||||
transformResponse: async (response) => {
|
||||
const data = await response.json()
|
||||
return {
|
||||
success: true,
|
||||
output: {
|
||||
message: 'Role created successfully',
|
||||
data,
|
||||
},
|
||||
}
|
||||
},
|
||||
|
||||
outputs: {
|
||||
message: { type: 'string', description: 'Success or error message' },
|
||||
data: {
|
||||
type: 'object',
|
||||
description: 'Created role data',
|
||||
properties: {
|
||||
id: { type: 'string', description: 'Role ID' },
|
||||
name: { type: 'string', description: 'Role name' },
|
||||
color: { type: 'number', description: 'Role color' },
|
||||
hoist: { type: 'boolean', description: 'Whether role is hoisted' },
|
||||
mentionable: { type: 'boolean', description: 'Whether role is mentionable' },
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
@@ -0,0 +1,114 @@
|
||||
import type { DiscordCreateThreadParams, DiscordCreateThreadResponse } from '@/tools/discord/types'
|
||||
import type { ToolConfig } from '@/tools/types'
|
||||
|
||||
export const discordCreateThreadTool: ToolConfig<
|
||||
DiscordCreateThreadParams,
|
||||
DiscordCreateThreadResponse
|
||||
> = {
|
||||
id: 'discord_create_thread',
|
||||
name: 'Discord Create Thread',
|
||||
description: 'Create a thread in a Discord channel',
|
||||
version: '1.0.0',
|
||||
|
||||
params: {
|
||||
botToken: {
|
||||
type: 'string',
|
||||
required: true,
|
||||
visibility: 'user-only',
|
||||
description: 'The bot token for authentication',
|
||||
},
|
||||
channelId: {
|
||||
type: 'string',
|
||||
required: true,
|
||||
visibility: 'user-or-llm',
|
||||
description: 'The Discord channel ID to create the thread in, e.g., 123456789012345678',
|
||||
},
|
||||
name: {
|
||||
type: 'string',
|
||||
required: true,
|
||||
visibility: 'user-or-llm',
|
||||
description: 'The name of the thread (1-100 characters)',
|
||||
},
|
||||
messageId: {
|
||||
type: 'string',
|
||||
required: false,
|
||||
visibility: 'user-or-llm',
|
||||
description:
|
||||
'The message ID to create a thread from (if creating from existing message), e.g., 123456789012345678',
|
||||
},
|
||||
autoArchiveDuration: {
|
||||
type: 'number',
|
||||
required: false,
|
||||
visibility: 'user-or-llm',
|
||||
description: 'Duration in minutes to auto-archive the thread (60, 1440, 4320, 10080)',
|
||||
},
|
||||
isPublic: {
|
||||
type: 'boolean',
|
||||
required: false,
|
||||
visibility: 'user-or-llm',
|
||||
description:
|
||||
'Whether the standalone thread is public (visible to everyone in the channel) or private. Ignored when creating a thread from an existing message, which always inherits the parent channel visibility. Defaults to public if omitted.',
|
||||
},
|
||||
serverId: {
|
||||
type: 'string',
|
||||
required: true,
|
||||
visibility: 'user-or-llm',
|
||||
description: 'The Discord server ID (guild ID), e.g., 123456789012345678',
|
||||
},
|
||||
},
|
||||
|
||||
request: {
|
||||
url: (params: DiscordCreateThreadParams) => {
|
||||
const messageId = params.messageId?.trim()
|
||||
if (messageId) {
|
||||
return `https://discord.com/api/v10/channels/${params.channelId.trim()}/messages/${messageId}/threads`
|
||||
}
|
||||
return `https://discord.com/api/v10/channels/${params.channelId.trim()}/threads`
|
||||
},
|
||||
method: 'POST',
|
||||
headers: (params) => ({
|
||||
'Content-Type': 'application/json',
|
||||
Authorization: `Bot ${params.botToken.trim()}`,
|
||||
}),
|
||||
body: (params: DiscordCreateThreadParams) => {
|
||||
const body: any = {
|
||||
name: params.name,
|
||||
}
|
||||
if (params.autoArchiveDuration) {
|
||||
body.auto_archive_duration = Number(params.autoArchiveDuration)
|
||||
}
|
||||
// Standalone threads (no source message) default to PRIVATE_THREAD per the Discord API
|
||||
// unless `type` is explicitly set, so pin it to PUBLIC_THREAD (11) unless the caller opts out.
|
||||
if (!params.messageId?.trim()) {
|
||||
body.type = params.isPublic === false ? 12 : 11
|
||||
}
|
||||
return body
|
||||
},
|
||||
},
|
||||
|
||||
transformResponse: async (response) => {
|
||||
const data = await response.json()
|
||||
return {
|
||||
success: true,
|
||||
output: {
|
||||
message: 'Thread created successfully',
|
||||
data,
|
||||
},
|
||||
}
|
||||
},
|
||||
|
||||
outputs: {
|
||||
message: { type: 'string', description: 'Success or error message' },
|
||||
data: {
|
||||
type: 'object',
|
||||
description: 'Created thread data',
|
||||
properties: {
|
||||
id: { type: 'string', description: 'Thread ID' },
|
||||
name: { type: 'string', description: 'Thread name' },
|
||||
type: { type: 'number', description: 'Thread channel type' },
|
||||
guild_id: { type: 'string', description: 'Server ID' },
|
||||
parent_id: { type: 'string', description: 'Parent channel ID' },
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
@@ -0,0 +1,84 @@
|
||||
import type {
|
||||
DiscordCreateWebhookParams,
|
||||
DiscordCreateWebhookResponse,
|
||||
} from '@/tools/discord/types'
|
||||
import type { ToolConfig } from '@/tools/types'
|
||||
|
||||
export const discordCreateWebhookTool: ToolConfig<
|
||||
DiscordCreateWebhookParams,
|
||||
DiscordCreateWebhookResponse
|
||||
> = {
|
||||
id: 'discord_create_webhook',
|
||||
name: 'Discord Create Webhook',
|
||||
description: 'Create a webhook in a Discord channel',
|
||||
version: '1.0.0',
|
||||
|
||||
params: {
|
||||
botToken: {
|
||||
type: 'string',
|
||||
required: true,
|
||||
visibility: 'user-only',
|
||||
description: 'The bot token for authentication',
|
||||
},
|
||||
channelId: {
|
||||
type: 'string',
|
||||
required: true,
|
||||
visibility: 'user-or-llm',
|
||||
description: 'The Discord channel ID to create the webhook in, e.g., 123456789012345678',
|
||||
},
|
||||
name: {
|
||||
type: 'string',
|
||||
required: true,
|
||||
visibility: 'user-or-llm',
|
||||
description: 'Name of the webhook (1-80 characters)',
|
||||
},
|
||||
serverId: {
|
||||
type: 'string',
|
||||
required: true,
|
||||
visibility: 'user-or-llm',
|
||||
description: 'The Discord server ID (guild ID), e.g., 123456789012345678',
|
||||
},
|
||||
},
|
||||
|
||||
request: {
|
||||
url: (params: DiscordCreateWebhookParams) => {
|
||||
return `https://discord.com/api/v10/channels/${params.channelId.trim()}/webhooks`
|
||||
},
|
||||
method: 'POST',
|
||||
headers: (params) => ({
|
||||
'Content-Type': 'application/json',
|
||||
Authorization: `Bot ${params.botToken.trim()}`,
|
||||
}),
|
||||
body: (params: DiscordCreateWebhookParams) => {
|
||||
return {
|
||||
name: params.name,
|
||||
}
|
||||
},
|
||||
},
|
||||
|
||||
transformResponse: async (response) => {
|
||||
const data = await response.json()
|
||||
return {
|
||||
success: true,
|
||||
output: {
|
||||
message: 'Webhook created successfully',
|
||||
data,
|
||||
},
|
||||
}
|
||||
},
|
||||
|
||||
outputs: {
|
||||
message: { type: 'string', description: 'Success or error message' },
|
||||
data: {
|
||||
type: 'object',
|
||||
description: 'Created webhook data',
|
||||
properties: {
|
||||
id: { type: 'string', description: 'Webhook ID' },
|
||||
name: { type: 'string', description: 'Webhook name' },
|
||||
token: { type: 'string', description: 'Webhook token' },
|
||||
url: { type: 'string', description: 'Webhook URL' },
|
||||
channel_id: { type: 'string', description: 'Channel ID' },
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
@@ -0,0 +1,71 @@
|
||||
import type {
|
||||
DiscordDeleteChannelParams,
|
||||
DiscordDeleteChannelResponse,
|
||||
} from '@/tools/discord/types'
|
||||
import type { ToolConfig } from '@/tools/types'
|
||||
|
||||
export const discordDeleteChannelTool: ToolConfig<
|
||||
DiscordDeleteChannelParams,
|
||||
DiscordDeleteChannelResponse
|
||||
> = {
|
||||
id: 'discord_delete_channel',
|
||||
name: 'Discord Delete Channel',
|
||||
description: 'Delete a Discord channel',
|
||||
version: '1.0.0',
|
||||
|
||||
params: {
|
||||
botToken: {
|
||||
type: 'string',
|
||||
required: true,
|
||||
visibility: 'user-only',
|
||||
description: 'The bot token for authentication',
|
||||
},
|
||||
channelId: {
|
||||
type: 'string',
|
||||
required: true,
|
||||
visibility: 'user-or-llm',
|
||||
description: 'The Discord channel ID to delete, e.g., 123456789012345678',
|
||||
},
|
||||
serverId: {
|
||||
type: 'string',
|
||||
required: true,
|
||||
visibility: 'user-or-llm',
|
||||
description: 'The Discord server ID (guild ID), e.g., 123456789012345678',
|
||||
},
|
||||
},
|
||||
|
||||
request: {
|
||||
url: (params: DiscordDeleteChannelParams) => {
|
||||
return `https://discord.com/api/v10/channels/${params.channelId.trim()}`
|
||||
},
|
||||
method: 'DELETE',
|
||||
headers: (params) => ({
|
||||
Authorization: `Bot ${params.botToken.trim()}`,
|
||||
}),
|
||||
},
|
||||
|
||||
transformResponse: async (response) => {
|
||||
const data = await response.json()
|
||||
return {
|
||||
success: true,
|
||||
output: {
|
||||
message: 'Channel deleted successfully',
|
||||
data,
|
||||
},
|
||||
}
|
||||
},
|
||||
|
||||
outputs: {
|
||||
message: { type: 'string', description: 'Success or error message' },
|
||||
data: {
|
||||
type: 'object',
|
||||
description: 'The deleted channel, as returned by Discord',
|
||||
properties: {
|
||||
id: { type: 'string', description: 'Channel ID' },
|
||||
name: { type: 'string', description: 'Channel name' },
|
||||
type: { type: 'number', description: 'Channel type' },
|
||||
guild_id: { type: 'string', description: 'Server ID' },
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
@@ -0,0 +1,56 @@
|
||||
import type { DiscordDeleteInviteParams, DiscordDeleteInviteResponse } from '@/tools/discord/types'
|
||||
import type { ToolConfig } from '@/tools/types'
|
||||
|
||||
export const discordDeleteInviteTool: ToolConfig<
|
||||
DiscordDeleteInviteParams,
|
||||
DiscordDeleteInviteResponse
|
||||
> = {
|
||||
id: 'discord_delete_invite',
|
||||
name: 'Discord Delete Invite',
|
||||
description: 'Delete a Discord invite',
|
||||
version: '1.0.0',
|
||||
|
||||
params: {
|
||||
botToken: {
|
||||
type: 'string',
|
||||
required: true,
|
||||
visibility: 'user-only',
|
||||
description: 'The bot token for authentication',
|
||||
},
|
||||
inviteCode: {
|
||||
type: 'string',
|
||||
required: true,
|
||||
visibility: 'user-or-llm',
|
||||
description: 'The invite code to delete',
|
||||
},
|
||||
serverId: {
|
||||
type: 'string',
|
||||
required: true,
|
||||
visibility: 'user-or-llm',
|
||||
description: 'The Discord server ID (guild ID), e.g., 123456789012345678',
|
||||
},
|
||||
},
|
||||
|
||||
request: {
|
||||
url: (params: DiscordDeleteInviteParams) => {
|
||||
return `https://discord.com/api/v10/invites/${params.inviteCode.trim()}`
|
||||
},
|
||||
method: 'DELETE',
|
||||
headers: (params) => ({
|
||||
Authorization: `Bot ${params.botToken.trim()}`,
|
||||
}),
|
||||
},
|
||||
|
||||
transformResponse: async (response) => {
|
||||
return {
|
||||
success: true,
|
||||
output: {
|
||||
message: 'Invite deleted successfully',
|
||||
},
|
||||
}
|
||||
},
|
||||
|
||||
outputs: {
|
||||
message: { type: 'string', description: 'Success or error message' },
|
||||
},
|
||||
}
|
||||
@@ -0,0 +1,65 @@
|
||||
import type {
|
||||
DiscordDeleteMessageParams,
|
||||
DiscordDeleteMessageResponse,
|
||||
} from '@/tools/discord/types'
|
||||
import type { ToolConfig } from '@/tools/types'
|
||||
|
||||
export const discordDeleteMessageTool: ToolConfig<
|
||||
DiscordDeleteMessageParams,
|
||||
DiscordDeleteMessageResponse
|
||||
> = {
|
||||
id: 'discord_delete_message',
|
||||
name: 'Discord Delete Message',
|
||||
description: 'Delete a message from a Discord channel',
|
||||
version: '1.0.0',
|
||||
|
||||
params: {
|
||||
botToken: {
|
||||
type: 'string',
|
||||
required: true,
|
||||
visibility: 'user-only',
|
||||
description: 'The bot token for authentication',
|
||||
},
|
||||
channelId: {
|
||||
type: 'string',
|
||||
required: true,
|
||||
visibility: 'user-or-llm',
|
||||
description: 'The Discord channel ID containing the message, e.g., 123456789012345678',
|
||||
},
|
||||
messageId: {
|
||||
type: 'string',
|
||||
required: true,
|
||||
visibility: 'user-or-llm',
|
||||
description: 'The ID of the message to delete, e.g., 123456789012345678',
|
||||
},
|
||||
serverId: {
|
||||
type: 'string',
|
||||
required: true,
|
||||
visibility: 'user-or-llm',
|
||||
description: 'The Discord server ID (guild ID), e.g., 123456789012345678',
|
||||
},
|
||||
},
|
||||
|
||||
request: {
|
||||
url: (params: DiscordDeleteMessageParams) => {
|
||||
return `https://discord.com/api/v10/channels/${params.channelId.trim()}/messages/${params.messageId.trim()}`
|
||||
},
|
||||
method: 'DELETE',
|
||||
headers: (params) => ({
|
||||
Authorization: `Bot ${params.botToken.trim()}`,
|
||||
}),
|
||||
},
|
||||
|
||||
transformResponse: async (response) => {
|
||||
return {
|
||||
success: true,
|
||||
output: {
|
||||
message: 'Message deleted successfully',
|
||||
},
|
||||
}
|
||||
},
|
||||
|
||||
outputs: {
|
||||
message: { type: 'string', description: 'Success or error message' },
|
||||
},
|
||||
}
|
||||
@@ -0,0 +1,54 @@
|
||||
import type { DiscordDeleteRoleParams, DiscordDeleteRoleResponse } from '@/tools/discord/types'
|
||||
import type { ToolConfig } from '@/tools/types'
|
||||
|
||||
export const discordDeleteRoleTool: ToolConfig<DiscordDeleteRoleParams, DiscordDeleteRoleResponse> =
|
||||
{
|
||||
id: 'discord_delete_role',
|
||||
name: 'Discord Delete Role',
|
||||
description: 'Delete a role from a Discord server',
|
||||
version: '1.0.0',
|
||||
|
||||
params: {
|
||||
botToken: {
|
||||
type: 'string',
|
||||
required: true,
|
||||
visibility: 'user-only',
|
||||
description: 'The bot token for authentication',
|
||||
},
|
||||
serverId: {
|
||||
type: 'string',
|
||||
required: true,
|
||||
visibility: 'user-or-llm',
|
||||
description: 'The Discord server ID (guild ID), e.g., 123456789012345678',
|
||||
},
|
||||
roleId: {
|
||||
type: 'string',
|
||||
required: true,
|
||||
visibility: 'user-or-llm',
|
||||
description: 'The role ID to delete, e.g., 123456789012345678',
|
||||
},
|
||||
},
|
||||
|
||||
request: {
|
||||
url: (params: DiscordDeleteRoleParams) => {
|
||||
return `https://discord.com/api/v10/guilds/${params.serverId.trim()}/roles/${params.roleId.trim()}`
|
||||
},
|
||||
method: 'DELETE',
|
||||
headers: (params) => ({
|
||||
Authorization: `Bot ${params.botToken.trim()}`,
|
||||
}),
|
||||
},
|
||||
|
||||
transformResponse: async (response) => {
|
||||
return {
|
||||
success: true,
|
||||
output: {
|
||||
message: 'Role deleted successfully',
|
||||
},
|
||||
}
|
||||
},
|
||||
|
||||
outputs: {
|
||||
message: { type: 'string', description: 'Success or error message' },
|
||||
},
|
||||
}
|
||||
@@ -0,0 +1,59 @@
|
||||
import type {
|
||||
DiscordDeleteWebhookParams,
|
||||
DiscordDeleteWebhookResponse,
|
||||
} from '@/tools/discord/types'
|
||||
import type { ToolConfig } from '@/tools/types'
|
||||
|
||||
export const discordDeleteWebhookTool: ToolConfig<
|
||||
DiscordDeleteWebhookParams,
|
||||
DiscordDeleteWebhookResponse
|
||||
> = {
|
||||
id: 'discord_delete_webhook',
|
||||
name: 'Discord Delete Webhook',
|
||||
description: 'Delete a Discord webhook',
|
||||
version: '1.0.0',
|
||||
|
||||
params: {
|
||||
botToken: {
|
||||
type: 'string',
|
||||
required: true,
|
||||
visibility: 'user-only',
|
||||
description: 'The bot token for authentication',
|
||||
},
|
||||
webhookId: {
|
||||
type: 'string',
|
||||
required: true,
|
||||
visibility: 'user-or-llm',
|
||||
description: 'The webhook ID to delete, e.g., 123456789012345678',
|
||||
},
|
||||
serverId: {
|
||||
type: 'string',
|
||||
required: true,
|
||||
visibility: 'user-or-llm',
|
||||
description: 'The Discord server ID (guild ID), e.g., 123456789012345678',
|
||||
},
|
||||
},
|
||||
|
||||
request: {
|
||||
url: (params: DiscordDeleteWebhookParams) => {
|
||||
return `https://discord.com/api/v10/webhooks/${params.webhookId.trim()}`
|
||||
},
|
||||
method: 'DELETE',
|
||||
headers: (params) => ({
|
||||
Authorization: `Bot ${params.botToken.trim()}`,
|
||||
}),
|
||||
},
|
||||
|
||||
transformResponse: async (response) => {
|
||||
return {
|
||||
success: true,
|
||||
output: {
|
||||
message: 'Webhook deleted successfully',
|
||||
},
|
||||
}
|
||||
},
|
||||
|
||||
outputs: {
|
||||
message: { type: 'string', description: 'Success or error message' },
|
||||
},
|
||||
}
|
||||
@@ -0,0 +1,88 @@
|
||||
import type { DiscordEditMessageParams, DiscordEditMessageResponse } from '@/tools/discord/types'
|
||||
import type { ToolConfig } from '@/tools/types'
|
||||
|
||||
export const discordEditMessageTool: ToolConfig<
|
||||
DiscordEditMessageParams,
|
||||
DiscordEditMessageResponse
|
||||
> = {
|
||||
id: 'discord_edit_message',
|
||||
name: 'Discord Edit Message',
|
||||
description: 'Edit an existing message in a Discord channel',
|
||||
version: '1.0.0',
|
||||
|
||||
params: {
|
||||
botToken: {
|
||||
type: 'string',
|
||||
required: true,
|
||||
visibility: 'user-only',
|
||||
description: 'The bot token for authentication',
|
||||
},
|
||||
channelId: {
|
||||
type: 'string',
|
||||
required: true,
|
||||
visibility: 'user-or-llm',
|
||||
description: 'The Discord channel ID containing the message, e.g., 123456789012345678',
|
||||
},
|
||||
messageId: {
|
||||
type: 'string',
|
||||
required: true,
|
||||
visibility: 'user-or-llm',
|
||||
description: 'The ID of the message to edit, e.g., 123456789012345678',
|
||||
},
|
||||
content: {
|
||||
type: 'string',
|
||||
required: false,
|
||||
visibility: 'user-or-llm',
|
||||
description: 'The new text content for the message',
|
||||
},
|
||||
serverId: {
|
||||
type: 'string',
|
||||
required: true,
|
||||
visibility: 'user-or-llm',
|
||||
description: 'The Discord server ID (guild ID), e.g., 123456789012345678',
|
||||
},
|
||||
},
|
||||
|
||||
request: {
|
||||
url: (params: DiscordEditMessageParams) => {
|
||||
return `https://discord.com/api/v10/channels/${params.channelId.trim()}/messages/${params.messageId.trim()}`
|
||||
},
|
||||
method: 'PATCH',
|
||||
headers: (params) => ({
|
||||
'Content-Type': 'application/json',
|
||||
Authorization: `Bot ${params.botToken.trim()}`,
|
||||
}),
|
||||
body: (params: DiscordEditMessageParams) => {
|
||||
const body: any = {}
|
||||
if (params.content !== undefined && params.content !== null && params.content !== '') {
|
||||
body.content = params.content
|
||||
}
|
||||
return body
|
||||
},
|
||||
},
|
||||
|
||||
transformResponse: async (response) => {
|
||||
const data = await response.json()
|
||||
return {
|
||||
success: true,
|
||||
output: {
|
||||
message: 'Message edited successfully',
|
||||
data,
|
||||
},
|
||||
}
|
||||
},
|
||||
|
||||
outputs: {
|
||||
message: { type: 'string', description: 'Success or error message' },
|
||||
data: {
|
||||
type: 'object',
|
||||
description: 'Updated Discord message data',
|
||||
properties: {
|
||||
id: { type: 'string', description: 'Message ID' },
|
||||
content: { type: 'string', description: 'Updated message content' },
|
||||
channel_id: { type: 'string', description: 'Channel ID' },
|
||||
edited_timestamp: { type: 'string', description: 'Message edited timestamp' },
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
@@ -0,0 +1,90 @@
|
||||
import type {
|
||||
DiscordExecuteWebhookParams,
|
||||
DiscordExecuteWebhookResponse,
|
||||
} from '@/tools/discord/types'
|
||||
import type { ToolConfig } from '@/tools/types'
|
||||
|
||||
export const discordExecuteWebhookTool: ToolConfig<
|
||||
DiscordExecuteWebhookParams,
|
||||
DiscordExecuteWebhookResponse
|
||||
> = {
|
||||
id: 'discord_execute_webhook',
|
||||
name: 'Discord Execute Webhook',
|
||||
description: 'Execute a Discord webhook to send a message',
|
||||
version: '1.0.0',
|
||||
|
||||
params: {
|
||||
webhookId: {
|
||||
type: 'string',
|
||||
required: true,
|
||||
visibility: 'user-or-llm',
|
||||
description: 'The webhook ID, e.g., 123456789012345678',
|
||||
},
|
||||
webhookToken: {
|
||||
type: 'string',
|
||||
required: true,
|
||||
visibility: 'user-only',
|
||||
description: 'The webhook token',
|
||||
},
|
||||
content: {
|
||||
type: 'string',
|
||||
required: true,
|
||||
visibility: 'user-or-llm',
|
||||
description: 'The message content to send',
|
||||
},
|
||||
username: {
|
||||
type: 'string',
|
||||
required: false,
|
||||
visibility: 'user-or-llm',
|
||||
description: 'Override the default username of the webhook',
|
||||
},
|
||||
serverId: {
|
||||
type: 'string',
|
||||
required: true,
|
||||
visibility: 'user-or-llm',
|
||||
description: 'The Discord server ID (guild ID), e.g., 123456789012345678',
|
||||
},
|
||||
},
|
||||
|
||||
request: {
|
||||
url: (params: DiscordExecuteWebhookParams) => {
|
||||
return `https://discord.com/api/v10/webhooks/${params.webhookId.trim()}/${params.webhookToken.trim()}?wait=true`
|
||||
},
|
||||
method: 'POST',
|
||||
headers: () => ({
|
||||
'Content-Type': 'application/json',
|
||||
}),
|
||||
body: (params: DiscordExecuteWebhookParams) => {
|
||||
const body: any = {
|
||||
content: params.content,
|
||||
}
|
||||
if (params.username) body.username = params.username
|
||||
return body
|
||||
},
|
||||
},
|
||||
|
||||
transformResponse: async (response) => {
|
||||
const data = await response.json()
|
||||
return {
|
||||
success: true,
|
||||
output: {
|
||||
message: 'Webhook executed successfully',
|
||||
data,
|
||||
},
|
||||
}
|
||||
},
|
||||
|
||||
outputs: {
|
||||
message: { type: 'string', description: 'Success or error message' },
|
||||
data: {
|
||||
type: 'object',
|
||||
description: 'Message sent via webhook',
|
||||
properties: {
|
||||
id: { type: 'string', description: 'Message ID' },
|
||||
content: { type: 'string', description: 'Message content' },
|
||||
channel_id: { type: 'string', description: 'Channel ID' },
|
||||
timestamp: { type: 'string', description: 'Message timestamp' },
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
@@ -0,0 +1,67 @@
|
||||
import type { DiscordGetChannelParams, DiscordGetChannelResponse } from '@/tools/discord/types'
|
||||
import type { ToolConfig } from '@/tools/types'
|
||||
|
||||
export const discordGetChannelTool: ToolConfig<DiscordGetChannelParams, DiscordGetChannelResponse> =
|
||||
{
|
||||
id: 'discord_get_channel',
|
||||
name: 'Discord Get Channel',
|
||||
description: 'Get information about a Discord channel',
|
||||
version: '1.0.0',
|
||||
|
||||
params: {
|
||||
botToken: {
|
||||
type: 'string',
|
||||
required: true,
|
||||
visibility: 'user-only',
|
||||
description: 'The bot token for authentication',
|
||||
},
|
||||
channelId: {
|
||||
type: 'string',
|
||||
required: true,
|
||||
visibility: 'user-or-llm',
|
||||
description: 'The Discord channel ID to retrieve, e.g., 123456789012345678',
|
||||
},
|
||||
serverId: {
|
||||
type: 'string',
|
||||
required: true,
|
||||
visibility: 'user-or-llm',
|
||||
description: 'The Discord server ID (guild ID), e.g., 123456789012345678',
|
||||
},
|
||||
},
|
||||
|
||||
request: {
|
||||
url: (params: DiscordGetChannelParams) => {
|
||||
return `https://discord.com/api/v10/channels/${params.channelId.trim()}`
|
||||
},
|
||||
method: 'GET',
|
||||
headers: (params) => ({
|
||||
Authorization: `Bot ${params.botToken.trim()}`,
|
||||
}),
|
||||
},
|
||||
|
||||
transformResponse: async (response) => {
|
||||
const data = await response.json()
|
||||
return {
|
||||
success: true,
|
||||
output: {
|
||||
message: 'Channel information retrieved successfully',
|
||||
data,
|
||||
},
|
||||
}
|
||||
},
|
||||
|
||||
outputs: {
|
||||
message: { type: 'string', description: 'Success or error message' },
|
||||
data: {
|
||||
type: 'object',
|
||||
description: 'Channel data',
|
||||
properties: {
|
||||
id: { type: 'string', description: 'Channel ID' },
|
||||
name: { type: 'string', description: 'Channel name' },
|
||||
type: { type: 'number', description: 'Channel type' },
|
||||
topic: { type: 'string', description: 'Channel topic' },
|
||||
guild_id: { type: 'string', description: 'Server ID' },
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
@@ -0,0 +1,66 @@
|
||||
import type { DiscordGetInviteParams, DiscordGetInviteResponse } from '@/tools/discord/types'
|
||||
import type { ToolConfig } from '@/tools/types'
|
||||
|
||||
export const discordGetInviteTool: ToolConfig<DiscordGetInviteParams, DiscordGetInviteResponse> = {
|
||||
id: 'discord_get_invite',
|
||||
name: 'Discord Get Invite',
|
||||
description: 'Get information about a Discord invite',
|
||||
version: '1.0.0',
|
||||
|
||||
params: {
|
||||
botToken: {
|
||||
type: 'string',
|
||||
required: true,
|
||||
visibility: 'user-only',
|
||||
description: 'The bot token for authentication',
|
||||
},
|
||||
inviteCode: {
|
||||
type: 'string',
|
||||
required: true,
|
||||
visibility: 'user-or-llm',
|
||||
description: 'The invite code to retrieve',
|
||||
},
|
||||
serverId: {
|
||||
type: 'string',
|
||||
required: true,
|
||||
visibility: 'user-or-llm',
|
||||
description: 'The Discord server ID (guild ID), e.g., 123456789012345678',
|
||||
},
|
||||
},
|
||||
|
||||
request: {
|
||||
url: (params: DiscordGetInviteParams) => {
|
||||
return `https://discord.com/api/v10/invites/${params.inviteCode.trim()}?with_counts=true`
|
||||
},
|
||||
method: 'GET',
|
||||
headers: (params) => ({
|
||||
Authorization: `Bot ${params.botToken.trim()}`,
|
||||
}),
|
||||
},
|
||||
|
||||
transformResponse: async (response) => {
|
||||
const data = await response.json()
|
||||
return {
|
||||
success: true,
|
||||
output: {
|
||||
message: 'Invite information retrieved successfully',
|
||||
data,
|
||||
},
|
||||
}
|
||||
},
|
||||
|
||||
outputs: {
|
||||
message: { type: 'string', description: 'Success or error message' },
|
||||
data: {
|
||||
type: 'object',
|
||||
description: 'Invite data',
|
||||
properties: {
|
||||
code: { type: 'string', description: 'Invite code' },
|
||||
guild: { type: 'object', description: 'Server information' },
|
||||
channel: { type: 'object', description: 'Channel information' },
|
||||
approximate_member_count: { type: 'number', description: 'Approximate member count' },
|
||||
approximate_presence_count: { type: 'number', description: 'Approximate online count' },
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
@@ -0,0 +1,73 @@
|
||||
import type { DiscordGetMemberParams, DiscordGetMemberResponse } from '@/tools/discord/types'
|
||||
import type { ToolConfig } from '@/tools/types'
|
||||
|
||||
export const discordGetMemberTool: ToolConfig<DiscordGetMemberParams, DiscordGetMemberResponse> = {
|
||||
id: 'discord_get_member',
|
||||
name: 'Discord Get Member',
|
||||
description: 'Get information about a member in a Discord server',
|
||||
version: '1.0.0',
|
||||
|
||||
params: {
|
||||
botToken: {
|
||||
type: 'string',
|
||||
required: true,
|
||||
visibility: 'user-only',
|
||||
description: 'The bot token for authentication',
|
||||
},
|
||||
serverId: {
|
||||
type: 'string',
|
||||
required: true,
|
||||
visibility: 'user-or-llm',
|
||||
description: 'The Discord server ID (guild ID), e.g., 123456789012345678',
|
||||
},
|
||||
userId: {
|
||||
type: 'string',
|
||||
required: true,
|
||||
visibility: 'user-or-llm',
|
||||
description: 'The user ID to retrieve, e.g., 123456789012345678',
|
||||
},
|
||||
},
|
||||
|
||||
request: {
|
||||
url: (params: DiscordGetMemberParams) => {
|
||||
return `https://discord.com/api/v10/guilds/${params.serverId.trim()}/members/${params.userId.trim()}`
|
||||
},
|
||||
method: 'GET',
|
||||
headers: (params) => ({
|
||||
Authorization: `Bot ${params.botToken.trim()}`,
|
||||
}),
|
||||
},
|
||||
|
||||
transformResponse: async (response) => {
|
||||
const data = await response.json()
|
||||
return {
|
||||
success: true,
|
||||
output: {
|
||||
message: 'Member information retrieved successfully',
|
||||
data,
|
||||
},
|
||||
}
|
||||
},
|
||||
|
||||
outputs: {
|
||||
message: { type: 'string', description: 'Success or error message' },
|
||||
data: {
|
||||
type: 'object',
|
||||
description: 'Member data',
|
||||
properties: {
|
||||
user: {
|
||||
type: 'object',
|
||||
description: 'User information',
|
||||
properties: {
|
||||
id: { type: 'string', description: 'User ID' },
|
||||
username: { type: 'string', description: 'Username' },
|
||||
avatar: { type: 'string', description: 'Avatar hash' },
|
||||
},
|
||||
},
|
||||
nick: { type: 'string', description: 'Server nickname' },
|
||||
roles: { type: 'array', description: 'Array of role IDs' },
|
||||
joined_at: { type: 'string', description: 'When the member joined' },
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
@@ -0,0 +1,109 @@
|
||||
import type { DiscordGetMessagesParams, DiscordGetMessagesResponse } from '@/tools/discord/types'
|
||||
import type { ToolConfig } from '@/tools/types'
|
||||
|
||||
export const discordGetMessagesTool: ToolConfig<
|
||||
DiscordGetMessagesParams,
|
||||
DiscordGetMessagesResponse
|
||||
> = {
|
||||
id: 'discord_get_messages',
|
||||
name: 'Discord Get Messages',
|
||||
description: 'Retrieve messages from a Discord channel',
|
||||
version: '1.0.0',
|
||||
|
||||
params: {
|
||||
botToken: {
|
||||
type: 'string',
|
||||
required: true,
|
||||
visibility: 'user-only',
|
||||
description: 'The bot token for authentication',
|
||||
},
|
||||
channelId: {
|
||||
type: 'string',
|
||||
required: true,
|
||||
visibility: 'user-or-llm',
|
||||
description: 'The Discord channel ID to retrieve messages from, e.g., 123456789012345678',
|
||||
},
|
||||
limit: {
|
||||
type: 'number',
|
||||
required: false,
|
||||
visibility: 'user-or-llm',
|
||||
description: 'Maximum number of messages to retrieve (default: 10, max: 100)',
|
||||
},
|
||||
},
|
||||
|
||||
request: {
|
||||
url: (params: DiscordGetMessagesParams) => {
|
||||
const limit = params.limit ? Number(params.limit) : 10
|
||||
return `https://discord.com/api/v10/channels/${params.channelId.trim()}/messages?limit=${Math.min(limit, 100)}`
|
||||
},
|
||||
method: 'GET',
|
||||
headers: (params) => {
|
||||
const headers: Record<string, string> = {
|
||||
'Content-Type': 'application/json',
|
||||
}
|
||||
|
||||
if (params.botToken) {
|
||||
headers.Authorization = `Bot ${params.botToken.trim()}`
|
||||
}
|
||||
|
||||
return headers
|
||||
},
|
||||
},
|
||||
|
||||
transformResponse: async (response) => {
|
||||
const messages = await response.json()
|
||||
return {
|
||||
success: true,
|
||||
output: {
|
||||
message: `Retrieved ${messages.length} messages from Discord channel`,
|
||||
data: {
|
||||
messages,
|
||||
channel_id: messages.length > 0 ? messages[0].channel_id : '',
|
||||
},
|
||||
},
|
||||
}
|
||||
},
|
||||
|
||||
outputs: {
|
||||
message: { type: 'string', description: 'Success or error message' },
|
||||
data: {
|
||||
type: 'object',
|
||||
description: 'Container for messages data',
|
||||
properties: {
|
||||
messages: {
|
||||
type: 'array',
|
||||
description: 'Array of Discord messages with full metadata',
|
||||
items: {
|
||||
type: 'object',
|
||||
properties: {
|
||||
id: { type: 'string', description: 'Message ID' },
|
||||
content: { type: 'string', description: 'Message content' },
|
||||
channel_id: { type: 'string', description: 'Channel ID' },
|
||||
author: {
|
||||
type: 'object',
|
||||
description: 'Message author information',
|
||||
properties: {
|
||||
id: { type: 'string', description: 'Author user ID' },
|
||||
username: { type: 'string', description: 'Author username' },
|
||||
avatar: { type: 'string', description: 'Author avatar hash' },
|
||||
bot: { type: 'boolean', description: 'Whether author is a bot' },
|
||||
},
|
||||
},
|
||||
timestamp: { type: 'string', description: 'Message timestamp' },
|
||||
edited_timestamp: { type: 'string', description: 'Message edited timestamp' },
|
||||
embeds: { type: 'array', description: 'Message embeds' },
|
||||
attachments: { type: 'array', description: 'Message attachments' },
|
||||
mentions: { type: 'array', description: 'User mentions in message' },
|
||||
mention_roles: { type: 'array', description: 'Role mentions in message' },
|
||||
mention_everyone: {
|
||||
type: 'boolean',
|
||||
description: 'Whether message mentions everyone',
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
channel_id: { type: 'string', description: 'Channel ID' },
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
@@ -0,0 +1,102 @@
|
||||
import type {
|
||||
DiscordGetPinnedMessagesParams,
|
||||
DiscordGetPinnedMessagesResponse,
|
||||
DiscordMessage,
|
||||
} from '@/tools/discord/types'
|
||||
import type { ToolConfig } from '@/tools/types'
|
||||
|
||||
export const discordGetPinnedMessagesTool: ToolConfig<
|
||||
DiscordGetPinnedMessagesParams,
|
||||
DiscordGetPinnedMessagesResponse
|
||||
> = {
|
||||
id: 'discord_get_pinned_messages',
|
||||
name: 'Discord Get Pinned Messages',
|
||||
description: 'Retrieve all pinned messages in a Discord channel',
|
||||
version: '1.0.0',
|
||||
|
||||
params: {
|
||||
botToken: {
|
||||
type: 'string',
|
||||
required: true,
|
||||
visibility: 'user-only',
|
||||
description: 'The bot token for authentication',
|
||||
},
|
||||
channelId: {
|
||||
type: 'string',
|
||||
required: true,
|
||||
visibility: 'user-or-llm',
|
||||
description:
|
||||
'The Discord channel ID to retrieve pinned messages from, e.g., 123456789012345678',
|
||||
},
|
||||
limit: {
|
||||
type: 'number',
|
||||
required: false,
|
||||
visibility: 'user-or-llm',
|
||||
description: 'Maximum number of pins to return per page (1-50). Defaults to 50.',
|
||||
},
|
||||
before: {
|
||||
type: 'string',
|
||||
required: false,
|
||||
visibility: 'user-or-llm',
|
||||
description:
|
||||
'Return pins created before this ISO8601 timestamp, for paging past the first 50 results',
|
||||
},
|
||||
},
|
||||
|
||||
request: {
|
||||
url: (params: DiscordGetPinnedMessagesParams) => {
|
||||
const query = new URLSearchParams()
|
||||
if (params.limit) query.set('limit', String(Math.min(Math.max(1, Number(params.limit)), 50)))
|
||||
if (params.before) query.set('before', params.before)
|
||||
const queryString = query.toString()
|
||||
return `https://discord.com/api/v10/channels/${params.channelId.trim()}/messages/pins${queryString ? `?${queryString}` : ''}`
|
||||
},
|
||||
method: 'GET',
|
||||
headers: (params) => ({
|
||||
Authorization: `Bot ${params.botToken.trim()}`,
|
||||
}),
|
||||
},
|
||||
|
||||
transformResponse: async (response) => {
|
||||
const result = await response.json()
|
||||
const items: Array<{ message: DiscordMessage; pinned_at: string }> = result.items ?? []
|
||||
return {
|
||||
success: true,
|
||||
output: {
|
||||
message: `Retrieved ${items.length} pinned messages from Discord channel`,
|
||||
data: items.map((item) => ({ ...item.message, pinned_at: item.pinned_at })),
|
||||
hasMore: result.has_more ?? false,
|
||||
},
|
||||
}
|
||||
},
|
||||
|
||||
outputs: {
|
||||
message: { type: 'string', description: 'Success or error message' },
|
||||
data: {
|
||||
type: 'array',
|
||||
description: 'Array of pinned Discord messages',
|
||||
items: {
|
||||
type: 'object',
|
||||
properties: {
|
||||
id: { type: 'string', description: 'Message ID' },
|
||||
content: { type: 'string', description: 'Message content' },
|
||||
channel_id: { type: 'string', description: 'Channel ID' },
|
||||
timestamp: { type: 'string', description: 'Message timestamp' },
|
||||
pinned_at: { type: 'string', description: 'When the message was pinned' },
|
||||
author: {
|
||||
type: 'object',
|
||||
description: 'Message author information',
|
||||
properties: {
|
||||
id: { type: 'string', description: 'Author user ID' },
|
||||
username: { type: 'string', description: 'Author username' },
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
hasMore: {
|
||||
type: 'boolean',
|
||||
description: 'Whether more pinned messages exist beyond this page',
|
||||
},
|
||||
},
|
||||
}
|
||||
@@ -0,0 +1,81 @@
|
||||
import type {
|
||||
DiscordGetServerParams,
|
||||
DiscordGetServerResponse,
|
||||
DiscordGuild,
|
||||
} from '@/tools/discord/types'
|
||||
import type { ToolConfig } from '@/tools/types'
|
||||
|
||||
export const discordGetServerTool: ToolConfig<DiscordGetServerParams, DiscordGetServerResponse> = {
|
||||
id: 'discord_get_server',
|
||||
name: 'Discord Get Server',
|
||||
description: 'Retrieve information about a Discord server (guild)',
|
||||
version: '1.0.0',
|
||||
|
||||
params: {
|
||||
botToken: {
|
||||
type: 'string',
|
||||
required: true,
|
||||
visibility: 'user-only',
|
||||
description: 'The bot token for authentication',
|
||||
},
|
||||
serverId: {
|
||||
type: 'string',
|
||||
required: true,
|
||||
visibility: 'user-or-llm',
|
||||
description: 'The Discord server ID (guild ID), e.g., 123456789012345678',
|
||||
},
|
||||
},
|
||||
|
||||
request: {
|
||||
url: (params: DiscordGetServerParams) =>
|
||||
`https://discord.com/api/v10/guilds/${params.serverId.trim()}?with_counts=true`,
|
||||
method: 'GET',
|
||||
headers: (params: DiscordGetServerParams) => {
|
||||
const headers: Record<string, string> = {
|
||||
'Content-Type': 'application/json',
|
||||
}
|
||||
|
||||
if (params.botToken) {
|
||||
headers.Authorization = `Bot ${params.botToken.trim()}`
|
||||
}
|
||||
|
||||
return headers
|
||||
},
|
||||
},
|
||||
|
||||
transformResponse: async (response: Response) => {
|
||||
const responseData = await response.json()
|
||||
|
||||
return {
|
||||
success: true,
|
||||
output: {
|
||||
message: 'Successfully retrieved server information',
|
||||
data: responseData as DiscordGuild,
|
||||
},
|
||||
}
|
||||
},
|
||||
|
||||
outputs: {
|
||||
message: { type: 'string', description: 'Success or error message' },
|
||||
data: {
|
||||
type: 'object',
|
||||
description: 'Discord server (guild) information',
|
||||
properties: {
|
||||
id: { type: 'string', description: 'Server ID' },
|
||||
name: { type: 'string', description: 'Server name' },
|
||||
icon: { type: 'string', description: 'Server icon hash' },
|
||||
description: { type: 'string', description: 'Server description' },
|
||||
owner_id: { type: 'string', description: 'Server owner user ID' },
|
||||
roles: { type: 'array', description: 'Server roles' },
|
||||
approximate_member_count: {
|
||||
type: 'number',
|
||||
description: 'Approximate total member count',
|
||||
},
|
||||
approximate_presence_count: {
|
||||
type: 'number',
|
||||
description: 'Approximate online member count',
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
@@ -0,0 +1,75 @@
|
||||
import type {
|
||||
DiscordGetUserParams,
|
||||
DiscordGetUserResponse,
|
||||
DiscordUser,
|
||||
} from '@/tools/discord/types'
|
||||
import type { ToolConfig } from '@/tools/types'
|
||||
|
||||
export const discordGetUserTool: ToolConfig<DiscordGetUserParams, DiscordGetUserResponse> = {
|
||||
id: 'discord_get_user',
|
||||
name: 'Discord Get User',
|
||||
description: 'Retrieve information about a Discord user',
|
||||
version: '1.0.0',
|
||||
|
||||
params: {
|
||||
botToken: {
|
||||
type: 'string',
|
||||
required: true,
|
||||
visibility: 'user-only',
|
||||
description: 'Discord bot token for authentication',
|
||||
},
|
||||
userId: {
|
||||
type: 'string',
|
||||
required: true,
|
||||
visibility: 'user-or-llm',
|
||||
description: 'The Discord user ID, e.g., 123456789012345678',
|
||||
},
|
||||
},
|
||||
|
||||
request: {
|
||||
url: (params: DiscordGetUserParams) =>
|
||||
`https://discord.com/api/v10/users/${params.userId.trim()}`,
|
||||
method: 'GET',
|
||||
headers: (params: DiscordGetUserParams) => {
|
||||
const headers: Record<string, string> = {
|
||||
'Content-Type': 'application/json',
|
||||
}
|
||||
|
||||
if (params.botToken) {
|
||||
headers.Authorization = `Bot ${params.botToken.trim()}`
|
||||
}
|
||||
|
||||
return headers
|
||||
},
|
||||
},
|
||||
|
||||
transformResponse: async (response) => {
|
||||
const data: DiscordUser = await response.json()
|
||||
|
||||
return {
|
||||
success: true,
|
||||
output: {
|
||||
message: `Retrieved information for Discord user: ${data.username}`,
|
||||
data,
|
||||
},
|
||||
}
|
||||
},
|
||||
|
||||
outputs: {
|
||||
message: { type: 'string', description: 'Success or error message' },
|
||||
data: {
|
||||
type: 'object',
|
||||
description: 'Discord user information',
|
||||
properties: {
|
||||
id: { type: 'string', description: 'User ID' },
|
||||
username: { type: 'string', description: 'Username' },
|
||||
discriminator: { type: 'string', description: 'User discriminator (4-digit number)' },
|
||||
avatar: { type: 'string', description: 'User avatar hash' },
|
||||
bot: { type: 'boolean', description: 'Whether user is a bot' },
|
||||
system: { type: 'boolean', description: 'Whether user is a system user' },
|
||||
email: { type: 'string', description: 'User email (if available)' },
|
||||
verified: { type: 'boolean', description: 'Whether user email is verified' },
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
@@ -0,0 +1,67 @@
|
||||
import type { DiscordGetWebhookParams, DiscordGetWebhookResponse } from '@/tools/discord/types'
|
||||
import type { ToolConfig } from '@/tools/types'
|
||||
|
||||
export const discordGetWebhookTool: ToolConfig<DiscordGetWebhookParams, DiscordGetWebhookResponse> =
|
||||
{
|
||||
id: 'discord_get_webhook',
|
||||
name: 'Discord Get Webhook',
|
||||
description: 'Get information about a Discord webhook',
|
||||
version: '1.0.0',
|
||||
|
||||
params: {
|
||||
botToken: {
|
||||
type: 'string',
|
||||
required: true,
|
||||
visibility: 'user-only',
|
||||
description: 'The bot token for authentication',
|
||||
},
|
||||
webhookId: {
|
||||
type: 'string',
|
||||
required: true,
|
||||
visibility: 'user-or-llm',
|
||||
description: 'The webhook ID to retrieve, e.g., 123456789012345678',
|
||||
},
|
||||
serverId: {
|
||||
type: 'string',
|
||||
required: true,
|
||||
visibility: 'user-or-llm',
|
||||
description: 'The Discord server ID (guild ID), e.g., 123456789012345678',
|
||||
},
|
||||
},
|
||||
|
||||
request: {
|
||||
url: (params: DiscordGetWebhookParams) => {
|
||||
return `https://discord.com/api/v10/webhooks/${params.webhookId.trim()}`
|
||||
},
|
||||
method: 'GET',
|
||||
headers: (params) => ({
|
||||
Authorization: `Bot ${params.botToken.trim()}`,
|
||||
}),
|
||||
},
|
||||
|
||||
transformResponse: async (response) => {
|
||||
const data = await response.json()
|
||||
return {
|
||||
success: true,
|
||||
output: {
|
||||
message: 'Webhook information retrieved successfully',
|
||||
data,
|
||||
},
|
||||
}
|
||||
},
|
||||
|
||||
outputs: {
|
||||
message: { type: 'string', description: 'Success or error message' },
|
||||
data: {
|
||||
type: 'object',
|
||||
description: 'Webhook data',
|
||||
properties: {
|
||||
id: { type: 'string', description: 'Webhook ID' },
|
||||
name: { type: 'string', description: 'Webhook name' },
|
||||
channel_id: { type: 'string', description: 'Channel ID' },
|
||||
guild_id: { type: 'string', description: 'Server ID' },
|
||||
token: { type: 'string', description: 'Webhook token' },
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
@@ -0,0 +1,81 @@
|
||||
import { discordAddReactionTool } from '@/tools/discord/add_reaction'
|
||||
import { discordArchiveThreadTool } from '@/tools/discord/archive_thread'
|
||||
import { discordAssignRoleTool } from '@/tools/discord/assign_role'
|
||||
import { discordBanMemberTool } from '@/tools/discord/ban_member'
|
||||
import { discordBulkDeleteMessagesTool } from '@/tools/discord/bulk_delete_messages'
|
||||
import { discordCreateChannelTool } from '@/tools/discord/create_channel'
|
||||
import { discordCreateInviteTool } from '@/tools/discord/create_invite'
|
||||
import { discordCreateRoleTool } from '@/tools/discord/create_role'
|
||||
import { discordCreateThreadTool } from '@/tools/discord/create_thread'
|
||||
import { discordCreateWebhookTool } from '@/tools/discord/create_webhook'
|
||||
import { discordDeleteChannelTool } from '@/tools/discord/delete_channel'
|
||||
import { discordDeleteInviteTool } from '@/tools/discord/delete_invite'
|
||||
import { discordDeleteMessageTool } from '@/tools/discord/delete_message'
|
||||
import { discordDeleteRoleTool } from '@/tools/discord/delete_role'
|
||||
import { discordDeleteWebhookTool } from '@/tools/discord/delete_webhook'
|
||||
import { discordEditMessageTool } from '@/tools/discord/edit_message'
|
||||
import { discordExecuteWebhookTool } from '@/tools/discord/execute_webhook'
|
||||
import { discordGetChannelTool } from '@/tools/discord/get_channel'
|
||||
import { discordGetInviteTool } from '@/tools/discord/get_invite'
|
||||
import { discordGetMemberTool } from '@/tools/discord/get_member'
|
||||
import { discordGetMessagesTool } from '@/tools/discord/get_messages'
|
||||
import { discordGetPinnedMessagesTool } from '@/tools/discord/get_pinned_messages'
|
||||
import { discordGetServerTool } from '@/tools/discord/get_server'
|
||||
import { discordGetUserTool } from '@/tools/discord/get_user'
|
||||
import { discordGetWebhookTool } from '@/tools/discord/get_webhook'
|
||||
import { discordJoinThreadTool } from '@/tools/discord/join_thread'
|
||||
import { discordKickMemberTool } from '@/tools/discord/kick_member'
|
||||
import { discordLeaveThreadTool } from '@/tools/discord/leave_thread'
|
||||
import { discordListChannelsTool } from '@/tools/discord/list_channels'
|
||||
import { discordListRolesTool } from '@/tools/discord/list_roles'
|
||||
import { discordPinMessageTool } from '@/tools/discord/pin_message'
|
||||
import { discordRemoveReactionTool } from '@/tools/discord/remove_reaction'
|
||||
import { discordRemoveRoleTool } from '@/tools/discord/remove_role'
|
||||
import { discordSendMessageTool } from '@/tools/discord/send_message'
|
||||
import { discordUnbanMemberTool } from '@/tools/discord/unban_member'
|
||||
import { discordUnpinMessageTool } from '@/tools/discord/unpin_message'
|
||||
import { discordUpdateChannelTool } from '@/tools/discord/update_channel'
|
||||
import { discordUpdateMemberTool } from '@/tools/discord/update_member'
|
||||
import { discordUpdateRoleTool } from '@/tools/discord/update_role'
|
||||
|
||||
export {
|
||||
discordSendMessageTool,
|
||||
discordGetMessagesTool,
|
||||
discordGetServerTool,
|
||||
discordGetUserTool,
|
||||
discordEditMessageTool,
|
||||
discordDeleteMessageTool,
|
||||
discordBulkDeleteMessagesTool,
|
||||
discordAddReactionTool,
|
||||
discordRemoveReactionTool,
|
||||
discordPinMessageTool,
|
||||
discordUnpinMessageTool,
|
||||
discordGetPinnedMessagesTool,
|
||||
discordCreateThreadTool,
|
||||
discordJoinThreadTool,
|
||||
discordLeaveThreadTool,
|
||||
discordArchiveThreadTool,
|
||||
discordCreateChannelTool,
|
||||
discordUpdateChannelTool,
|
||||
discordDeleteChannelTool,
|
||||
discordGetChannelTool,
|
||||
discordListChannelsTool,
|
||||
discordCreateRoleTool,
|
||||
discordUpdateRoleTool,
|
||||
discordDeleteRoleTool,
|
||||
discordAssignRoleTool,
|
||||
discordRemoveRoleTool,
|
||||
discordListRolesTool,
|
||||
discordKickMemberTool,
|
||||
discordBanMemberTool,
|
||||
discordUnbanMemberTool,
|
||||
discordGetMemberTool,
|
||||
discordUpdateMemberTool,
|
||||
discordCreateInviteTool,
|
||||
discordGetInviteTool,
|
||||
discordDeleteInviteTool,
|
||||
discordCreateWebhookTool,
|
||||
discordExecuteWebhookTool,
|
||||
discordGetWebhookTool,
|
||||
discordDeleteWebhookTool,
|
||||
}
|
||||
@@ -0,0 +1,54 @@
|
||||
import type { DiscordJoinThreadParams, DiscordJoinThreadResponse } from '@/tools/discord/types'
|
||||
import type { ToolConfig } from '@/tools/types'
|
||||
|
||||
export const discordJoinThreadTool: ToolConfig<DiscordJoinThreadParams, DiscordJoinThreadResponse> =
|
||||
{
|
||||
id: 'discord_join_thread',
|
||||
name: 'Discord Join Thread',
|
||||
description: 'Join a thread in Discord',
|
||||
version: '1.0.0',
|
||||
|
||||
params: {
|
||||
botToken: {
|
||||
type: 'string',
|
||||
required: true,
|
||||
visibility: 'user-only',
|
||||
description: 'The bot token for authentication',
|
||||
},
|
||||
threadId: {
|
||||
type: 'string',
|
||||
required: true,
|
||||
visibility: 'user-or-llm',
|
||||
description: 'The thread ID to join, e.g., 123456789012345678',
|
||||
},
|
||||
serverId: {
|
||||
type: 'string',
|
||||
required: true,
|
||||
visibility: 'user-or-llm',
|
||||
description: 'The Discord server ID (guild ID), e.g., 123456789012345678',
|
||||
},
|
||||
},
|
||||
|
||||
request: {
|
||||
url: (params: DiscordJoinThreadParams) => {
|
||||
return `https://discord.com/api/v10/channels/${params.threadId.trim()}/thread-members/@me`
|
||||
},
|
||||
method: 'PUT',
|
||||
headers: (params) => ({
|
||||
Authorization: `Bot ${params.botToken.trim()}`,
|
||||
}),
|
||||
},
|
||||
|
||||
transformResponse: async (response) => {
|
||||
return {
|
||||
success: true,
|
||||
output: {
|
||||
message: 'Joined thread successfully',
|
||||
},
|
||||
}
|
||||
},
|
||||
|
||||
outputs: {
|
||||
message: { type: 'string', description: 'Success or error message' },
|
||||
},
|
||||
}
|
||||
@@ -0,0 +1,66 @@
|
||||
import type { DiscordKickMemberParams, DiscordKickMemberResponse } from '@/tools/discord/types'
|
||||
import type { ToolConfig } from '@/tools/types'
|
||||
|
||||
export const discordKickMemberTool: ToolConfig<DiscordKickMemberParams, DiscordKickMemberResponse> =
|
||||
{
|
||||
id: 'discord_kick_member',
|
||||
name: 'Discord Kick Member',
|
||||
description: 'Kick a member from a Discord server',
|
||||
version: '1.0.0',
|
||||
|
||||
params: {
|
||||
botToken: {
|
||||
type: 'string',
|
||||
required: true,
|
||||
visibility: 'user-only',
|
||||
description: 'The bot token for authentication',
|
||||
},
|
||||
serverId: {
|
||||
type: 'string',
|
||||
required: true,
|
||||
visibility: 'user-or-llm',
|
||||
description: 'The Discord server ID (guild ID), e.g., 123456789012345678',
|
||||
},
|
||||
userId: {
|
||||
type: 'string',
|
||||
required: true,
|
||||
visibility: 'user-or-llm',
|
||||
description: 'The user ID to kick, e.g., 123456789012345678',
|
||||
},
|
||||
reason: {
|
||||
type: 'string',
|
||||
required: false,
|
||||
visibility: 'user-or-llm',
|
||||
description: 'Reason for kicking the member',
|
||||
},
|
||||
},
|
||||
|
||||
request: {
|
||||
url: (params: DiscordKickMemberParams) => {
|
||||
return `https://discord.com/api/v10/guilds/${params.serverId.trim()}/members/${params.userId.trim()}`
|
||||
},
|
||||
method: 'DELETE',
|
||||
headers: (params) => {
|
||||
const headers: Record<string, string> = {
|
||||
Authorization: `Bot ${params.botToken.trim()}`,
|
||||
}
|
||||
if (params.reason) {
|
||||
headers['X-Audit-Log-Reason'] = encodeURIComponent(params.reason)
|
||||
}
|
||||
return headers
|
||||
},
|
||||
},
|
||||
|
||||
transformResponse: async (response) => {
|
||||
return {
|
||||
success: true,
|
||||
output: {
|
||||
message: 'Member kicked successfully',
|
||||
},
|
||||
}
|
||||
},
|
||||
|
||||
outputs: {
|
||||
message: { type: 'string', description: 'Success or error message' },
|
||||
},
|
||||
}
|
||||
@@ -0,0 +1,56 @@
|
||||
import type { DiscordLeaveThreadParams, DiscordLeaveThreadResponse } from '@/tools/discord/types'
|
||||
import type { ToolConfig } from '@/tools/types'
|
||||
|
||||
export const discordLeaveThreadTool: ToolConfig<
|
||||
DiscordLeaveThreadParams,
|
||||
DiscordLeaveThreadResponse
|
||||
> = {
|
||||
id: 'discord_leave_thread',
|
||||
name: 'Discord Leave Thread',
|
||||
description: 'Leave a thread in Discord',
|
||||
version: '1.0.0',
|
||||
|
||||
params: {
|
||||
botToken: {
|
||||
type: 'string',
|
||||
required: true,
|
||||
visibility: 'user-only',
|
||||
description: 'The bot token for authentication',
|
||||
},
|
||||
threadId: {
|
||||
type: 'string',
|
||||
required: true,
|
||||
visibility: 'user-or-llm',
|
||||
description: 'The thread ID to leave, e.g., 123456789012345678',
|
||||
},
|
||||
serverId: {
|
||||
type: 'string',
|
||||
required: true,
|
||||
visibility: 'user-or-llm',
|
||||
description: 'The Discord server ID (guild ID), e.g., 123456789012345678',
|
||||
},
|
||||
},
|
||||
|
||||
request: {
|
||||
url: (params: DiscordLeaveThreadParams) => {
|
||||
return `https://discord.com/api/v10/channels/${params.threadId.trim()}/thread-members/@me`
|
||||
},
|
||||
method: 'DELETE',
|
||||
headers: (params) => ({
|
||||
Authorization: `Bot ${params.botToken.trim()}`,
|
||||
}),
|
||||
},
|
||||
|
||||
transformResponse: async (response) => {
|
||||
return {
|
||||
success: true,
|
||||
output: {
|
||||
message: 'Left thread successfully',
|
||||
},
|
||||
}
|
||||
},
|
||||
|
||||
outputs: {
|
||||
message: { type: 'string', description: 'Success or error message' },
|
||||
},
|
||||
}
|
||||
@@ -0,0 +1,67 @@
|
||||
import type { DiscordListChannelsParams, DiscordListChannelsResponse } from '@/tools/discord/types'
|
||||
import type { ToolConfig } from '@/tools/types'
|
||||
|
||||
export const discordListChannelsTool: ToolConfig<
|
||||
DiscordListChannelsParams,
|
||||
DiscordListChannelsResponse
|
||||
> = {
|
||||
id: 'discord_list_channels',
|
||||
name: 'Discord List Channels',
|
||||
description: 'List all channels in a Discord server',
|
||||
version: '1.0.0',
|
||||
|
||||
params: {
|
||||
botToken: {
|
||||
type: 'string',
|
||||
required: true,
|
||||
visibility: 'user-only',
|
||||
description: 'The bot token for authentication',
|
||||
},
|
||||
serverId: {
|
||||
type: 'string',
|
||||
required: true,
|
||||
visibility: 'user-or-llm',
|
||||
description: 'The Discord server ID (guild ID), e.g., 123456789012345678',
|
||||
},
|
||||
},
|
||||
|
||||
request: {
|
||||
url: (params: DiscordListChannelsParams) => {
|
||||
return `https://discord.com/api/v10/guilds/${params.serverId.trim()}/channels`
|
||||
},
|
||||
method: 'GET',
|
||||
headers: (params) => ({
|
||||
Authorization: `Bot ${params.botToken.trim()}`,
|
||||
}),
|
||||
},
|
||||
|
||||
transformResponse: async (response) => {
|
||||
const channels = await response.json()
|
||||
return {
|
||||
success: true,
|
||||
output: {
|
||||
message: `Retrieved ${channels.length} channels from Discord server`,
|
||||
data: channels,
|
||||
},
|
||||
}
|
||||
},
|
||||
|
||||
outputs: {
|
||||
message: { type: 'string', description: 'Success or error message' },
|
||||
data: {
|
||||
type: 'array',
|
||||
description: 'Array of Discord channels in the server',
|
||||
items: {
|
||||
type: 'object',
|
||||
properties: {
|
||||
id: { type: 'string', description: 'Channel ID' },
|
||||
name: { type: 'string', description: 'Channel name' },
|
||||
type: { type: 'number', description: 'Channel type' },
|
||||
topic: { type: 'string', description: 'Channel topic' },
|
||||
parent_id: { type: 'string', description: 'Parent category ID' },
|
||||
position: { type: 'number', description: 'Sort position within the channel list' },
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
@@ -0,0 +1,64 @@
|
||||
import type { DiscordListRolesParams, DiscordListRolesResponse } from '@/tools/discord/types'
|
||||
import type { ToolConfig } from '@/tools/types'
|
||||
|
||||
export const discordListRolesTool: ToolConfig<DiscordListRolesParams, DiscordListRolesResponse> = {
|
||||
id: 'discord_list_roles',
|
||||
name: 'Discord List Roles',
|
||||
description: 'List all roles in a Discord server',
|
||||
version: '1.0.0',
|
||||
|
||||
params: {
|
||||
botToken: {
|
||||
type: 'string',
|
||||
required: true,
|
||||
visibility: 'user-only',
|
||||
description: 'The bot token for authentication',
|
||||
},
|
||||
serverId: {
|
||||
type: 'string',
|
||||
required: true,
|
||||
visibility: 'user-or-llm',
|
||||
description: 'The Discord server ID (guild ID), e.g., 123456789012345678',
|
||||
},
|
||||
},
|
||||
|
||||
request: {
|
||||
url: (params: DiscordListRolesParams) => {
|
||||
return `https://discord.com/api/v10/guilds/${params.serverId.trim()}/roles`
|
||||
},
|
||||
method: 'GET',
|
||||
headers: (params) => ({
|
||||
Authorization: `Bot ${params.botToken.trim()}`,
|
||||
}),
|
||||
},
|
||||
|
||||
transformResponse: async (response) => {
|
||||
const roles = await response.json()
|
||||
return {
|
||||
success: true,
|
||||
output: {
|
||||
message: `Retrieved ${roles.length} roles from Discord server`,
|
||||
data: roles,
|
||||
},
|
||||
}
|
||||
},
|
||||
|
||||
outputs: {
|
||||
message: { type: 'string', description: 'Success or error message' },
|
||||
data: {
|
||||
type: 'array',
|
||||
description: 'Array of Discord roles in the server',
|
||||
items: {
|
||||
type: 'object',
|
||||
properties: {
|
||||
id: { type: 'string', description: 'Role ID' },
|
||||
name: { type: 'string', description: 'Role name' },
|
||||
color: { type: 'number', description: 'Role color' },
|
||||
hoist: { type: 'boolean', description: 'Whether role is hoisted' },
|
||||
position: { type: 'number', description: 'Role position in the hierarchy' },
|
||||
mentionable: { type: 'boolean', description: 'Whether role is mentionable' },
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
@@ -0,0 +1,60 @@
|
||||
import type { DiscordPinMessageParams, DiscordPinMessageResponse } from '@/tools/discord/types'
|
||||
import type { ToolConfig } from '@/tools/types'
|
||||
|
||||
export const discordPinMessageTool: ToolConfig<DiscordPinMessageParams, DiscordPinMessageResponse> =
|
||||
{
|
||||
id: 'discord_pin_message',
|
||||
name: 'Discord Pin Message',
|
||||
description: 'Pin a message in a Discord channel',
|
||||
version: '1.0.0',
|
||||
|
||||
params: {
|
||||
botToken: {
|
||||
type: 'string',
|
||||
required: true,
|
||||
visibility: 'user-only',
|
||||
description: 'The bot token for authentication',
|
||||
},
|
||||
channelId: {
|
||||
type: 'string',
|
||||
required: true,
|
||||
visibility: 'user-or-llm',
|
||||
description: 'The Discord channel ID containing the message, e.g., 123456789012345678',
|
||||
},
|
||||
messageId: {
|
||||
type: 'string',
|
||||
required: true,
|
||||
visibility: 'user-or-llm',
|
||||
description: 'The ID of the message to pin, e.g., 123456789012345678',
|
||||
},
|
||||
serverId: {
|
||||
type: 'string',
|
||||
required: true,
|
||||
visibility: 'user-or-llm',
|
||||
description: 'The Discord server ID (guild ID), e.g., 123456789012345678',
|
||||
},
|
||||
},
|
||||
|
||||
request: {
|
||||
url: (params: DiscordPinMessageParams) => {
|
||||
return `https://discord.com/api/v10/channels/${params.channelId.trim()}/pins/${params.messageId.trim()}`
|
||||
},
|
||||
method: 'PUT',
|
||||
headers: (params) => ({
|
||||
Authorization: `Bot ${params.botToken.trim()}`,
|
||||
}),
|
||||
},
|
||||
|
||||
transformResponse: async (response) => {
|
||||
return {
|
||||
success: true,
|
||||
output: {
|
||||
message: 'Message pinned successfully',
|
||||
},
|
||||
}
|
||||
},
|
||||
|
||||
outputs: {
|
||||
message: { type: 'string', description: 'Success or error message' },
|
||||
},
|
||||
}
|
||||
@@ -0,0 +1,81 @@
|
||||
import type {
|
||||
DiscordRemoveReactionParams,
|
||||
DiscordRemoveReactionResponse,
|
||||
} from '@/tools/discord/types'
|
||||
import type { ToolConfig } from '@/tools/types'
|
||||
|
||||
export const discordRemoveReactionTool: ToolConfig<
|
||||
DiscordRemoveReactionParams,
|
||||
DiscordRemoveReactionResponse
|
||||
> = {
|
||||
id: 'discord_remove_reaction',
|
||||
name: 'Discord Remove Reaction',
|
||||
description: 'Remove a reaction from a Discord message',
|
||||
version: '1.0.0',
|
||||
|
||||
params: {
|
||||
botToken: {
|
||||
type: 'string',
|
||||
required: true,
|
||||
visibility: 'user-only',
|
||||
description: 'The bot token for authentication',
|
||||
},
|
||||
channelId: {
|
||||
type: 'string',
|
||||
required: true,
|
||||
visibility: 'user-or-llm',
|
||||
description: 'The Discord channel ID containing the message, e.g., 123456789012345678',
|
||||
},
|
||||
messageId: {
|
||||
type: 'string',
|
||||
required: true,
|
||||
visibility: 'user-or-llm',
|
||||
description: 'The ID of the message with the reaction, e.g., 123456789012345678',
|
||||
},
|
||||
emoji: {
|
||||
type: 'string',
|
||||
required: true,
|
||||
visibility: 'user-or-llm',
|
||||
description: 'The emoji to remove (unicode emoji or custom emoji in name:id format)',
|
||||
},
|
||||
userId: {
|
||||
type: 'string',
|
||||
required: false,
|
||||
visibility: 'user-or-llm',
|
||||
description:
|
||||
"The user ID whose reaction to remove (omit to remove bot's own reaction), e.g., 123456789012345678",
|
||||
},
|
||||
serverId: {
|
||||
type: 'string',
|
||||
required: true,
|
||||
visibility: 'user-or-llm',
|
||||
description: 'The Discord server ID (guild ID), e.g., 123456789012345678',
|
||||
},
|
||||
},
|
||||
|
||||
request: {
|
||||
url: (params: DiscordRemoveReactionParams) => {
|
||||
const encodedEmoji = encodeURIComponent(params.emoji)
|
||||
const userId = params.userId?.trim()
|
||||
const userPart = userId ? `/${userId}` : '/@me'
|
||||
return `https://discord.com/api/v10/channels/${params.channelId.trim()}/messages/${params.messageId.trim()}/reactions/${encodedEmoji}${userPart}`
|
||||
},
|
||||
method: 'DELETE',
|
||||
headers: (params) => ({
|
||||
Authorization: `Bot ${params.botToken.trim()}`,
|
||||
}),
|
||||
},
|
||||
|
||||
transformResponse: async (response) => {
|
||||
return {
|
||||
success: true,
|
||||
output: {
|
||||
message: 'Reaction removed successfully',
|
||||
},
|
||||
}
|
||||
},
|
||||
|
||||
outputs: {
|
||||
message: { type: 'string', description: 'Success or error message' },
|
||||
},
|
||||
}
|
||||
@@ -0,0 +1,60 @@
|
||||
import type { DiscordRemoveRoleParams, DiscordRemoveRoleResponse } from '@/tools/discord/types'
|
||||
import type { ToolConfig } from '@/tools/types'
|
||||
|
||||
export const discordRemoveRoleTool: ToolConfig<DiscordRemoveRoleParams, DiscordRemoveRoleResponse> =
|
||||
{
|
||||
id: 'discord_remove_role',
|
||||
name: 'Discord Remove Role',
|
||||
description: 'Remove a role from a member in a Discord server',
|
||||
version: '1.0.0',
|
||||
|
||||
params: {
|
||||
botToken: {
|
||||
type: 'string',
|
||||
required: true,
|
||||
visibility: 'user-only',
|
||||
description: 'The bot token for authentication',
|
||||
},
|
||||
serverId: {
|
||||
type: 'string',
|
||||
required: true,
|
||||
visibility: 'user-or-llm',
|
||||
description: 'The Discord server ID (guild ID), e.g., 123456789012345678',
|
||||
},
|
||||
userId: {
|
||||
type: 'string',
|
||||
required: true,
|
||||
visibility: 'user-or-llm',
|
||||
description: 'The user ID to remove the role from, e.g., 123456789012345678',
|
||||
},
|
||||
roleId: {
|
||||
type: 'string',
|
||||
required: true,
|
||||
visibility: 'user-or-llm',
|
||||
description: 'The role ID to remove, e.g., 123456789012345678',
|
||||
},
|
||||
},
|
||||
|
||||
request: {
|
||||
url: (params: DiscordRemoveRoleParams) => {
|
||||
return `https://discord.com/api/v10/guilds/${params.serverId.trim()}/members/${params.userId.trim()}/roles/${params.roleId.trim()}`
|
||||
},
|
||||
method: 'DELETE',
|
||||
headers: (params) => ({
|
||||
Authorization: `Bot ${params.botToken.trim()}`,
|
||||
}),
|
||||
},
|
||||
|
||||
transformResponse: async (response) => {
|
||||
return {
|
||||
success: true,
|
||||
output: {
|
||||
message: 'Role removed successfully',
|
||||
},
|
||||
}
|
||||
},
|
||||
|
||||
outputs: {
|
||||
message: { type: 'string', description: 'Success or error message' },
|
||||
},
|
||||
}
|
||||
@@ -0,0 +1,103 @@
|
||||
import type { DiscordSendMessageParams, DiscordSendMessageResponse } from '@/tools/discord/types'
|
||||
import type { ToolConfig } from '@/tools/types'
|
||||
|
||||
export const discordSendMessageTool: ToolConfig<
|
||||
DiscordSendMessageParams,
|
||||
DiscordSendMessageResponse
|
||||
> = {
|
||||
id: 'discord_send_message',
|
||||
name: 'Discord Send Message',
|
||||
description: 'Send a message to a Discord channel',
|
||||
version: '1.0.0',
|
||||
|
||||
params: {
|
||||
botToken: {
|
||||
type: 'string',
|
||||
required: true,
|
||||
visibility: 'user-only',
|
||||
description: 'The bot token for authentication',
|
||||
},
|
||||
channelId: {
|
||||
type: 'string',
|
||||
required: true,
|
||||
visibility: 'user-or-llm',
|
||||
description: 'The Discord channel ID to send the message to, e.g., 123456789012345678',
|
||||
},
|
||||
content: {
|
||||
type: 'string',
|
||||
required: false,
|
||||
visibility: 'user-or-llm',
|
||||
description: 'The text content of the message',
|
||||
},
|
||||
serverId: {
|
||||
type: 'string',
|
||||
required: true,
|
||||
visibility: 'user-or-llm',
|
||||
description: 'The Discord server ID (guild ID), e.g., 123456789012345678',
|
||||
},
|
||||
files: {
|
||||
type: 'file[]',
|
||||
required: false,
|
||||
visibility: 'user-only',
|
||||
description: 'Files to attach to the message',
|
||||
},
|
||||
},
|
||||
|
||||
request: {
|
||||
url: '/api/tools/discord/send-message',
|
||||
method: 'POST',
|
||||
headers: () => ({
|
||||
'Content-Type': 'application/json',
|
||||
}),
|
||||
body: (params: DiscordSendMessageParams) => {
|
||||
return {
|
||||
botToken: params.botToken.trim(),
|
||||
channelId: params.channelId.trim(),
|
||||
content: params.content || 'Message sent from Sim',
|
||||
files: params.files || null,
|
||||
}
|
||||
},
|
||||
},
|
||||
|
||||
transformResponse: async (response) => {
|
||||
const data = await response.json()
|
||||
if (!data.success) {
|
||||
throw new Error(data.error || 'Failed to send Discord message')
|
||||
}
|
||||
return {
|
||||
success: true,
|
||||
output: data.output,
|
||||
}
|
||||
},
|
||||
|
||||
outputs: {
|
||||
message: { type: 'string', description: 'Success or error message' },
|
||||
files: { type: 'file[]', description: 'Files attached to the message' },
|
||||
data: {
|
||||
type: 'object',
|
||||
description: 'Discord message data',
|
||||
properties: {
|
||||
id: { type: 'string', description: 'Message ID' },
|
||||
content: { type: 'string', description: 'Message content' },
|
||||
channel_id: { type: 'string', description: 'Channel ID where message was sent' },
|
||||
author: {
|
||||
type: 'object',
|
||||
description: 'Message author information',
|
||||
properties: {
|
||||
id: { type: 'string', description: 'Author user ID' },
|
||||
username: { type: 'string', description: 'Author username' },
|
||||
avatar: { type: 'string', description: 'Author avatar hash' },
|
||||
bot: { type: 'boolean', description: 'Whether author is a bot' },
|
||||
},
|
||||
},
|
||||
timestamp: { type: 'string', description: 'Message timestamp' },
|
||||
edited_timestamp: { type: 'string', description: 'Message edited timestamp' },
|
||||
embeds: { type: 'array', description: 'Message embeds' },
|
||||
attachments: { type: 'array', description: 'Message attachments' },
|
||||
mentions: { type: 'array', description: 'User mentions in message' },
|
||||
mention_roles: { type: 'array', description: 'Role mentions in message' },
|
||||
mention_everyone: { type: 'boolean', description: 'Whether message mentions everyone' },
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
@@ -0,0 +1,577 @@
|
||||
import type { UserFile } from '@/executor/types'
|
||||
import type { ToolFileData } from '@/tools/types'
|
||||
|
||||
export interface DiscordMessage {
|
||||
id: string
|
||||
content: string
|
||||
channel_id: string
|
||||
author: {
|
||||
id: string
|
||||
username: string
|
||||
avatar?: string
|
||||
bot: boolean
|
||||
}
|
||||
timestamp: string
|
||||
edited_timestamp?: string | null
|
||||
embeds: any[]
|
||||
attachments: any[]
|
||||
mentions: any[]
|
||||
mention_roles: string[]
|
||||
mention_everyone: boolean
|
||||
}
|
||||
|
||||
interface DiscordAPIError {
|
||||
code: number
|
||||
message: string
|
||||
errors?: Record<string, any>
|
||||
}
|
||||
|
||||
export interface DiscordGuild {
|
||||
id: string
|
||||
name: string
|
||||
icon?: string
|
||||
description?: string
|
||||
owner_id: string
|
||||
roles: any[]
|
||||
approximate_member_count?: number
|
||||
approximate_presence_count?: number
|
||||
}
|
||||
|
||||
export interface DiscordUser {
|
||||
id: string
|
||||
username: string
|
||||
discriminator: string
|
||||
avatar?: string
|
||||
bot?: boolean
|
||||
system?: boolean
|
||||
email?: string
|
||||
verified?: boolean
|
||||
}
|
||||
|
||||
interface DiscordAuthParams {
|
||||
botToken: string
|
||||
serverId: string
|
||||
}
|
||||
|
||||
export interface DiscordSendMessageParams extends DiscordAuthParams {
|
||||
channelId: string
|
||||
content?: string
|
||||
embed?: {
|
||||
title?: string
|
||||
description?: string
|
||||
color?: string | number
|
||||
}
|
||||
files?: UserFile[]
|
||||
}
|
||||
|
||||
export interface DiscordGetMessagesParams extends DiscordAuthParams {
|
||||
channelId: string
|
||||
limit?: number
|
||||
}
|
||||
|
||||
export interface DiscordGetServerParams extends Omit<DiscordAuthParams, 'serverId'> {
|
||||
serverId: string
|
||||
}
|
||||
|
||||
export interface DiscordGetUserParams extends Omit<DiscordAuthParams, 'serverId'> {
|
||||
userId: string
|
||||
}
|
||||
|
||||
interface BaseDiscordResponse {
|
||||
success: boolean
|
||||
output: Record<string, any>
|
||||
error?: string
|
||||
}
|
||||
|
||||
export interface DiscordSendMessageResponse extends BaseDiscordResponse {
|
||||
output: {
|
||||
message: string
|
||||
files?: ToolFileData[]
|
||||
data?: DiscordMessage
|
||||
}
|
||||
}
|
||||
|
||||
export interface DiscordGetMessagesResponse extends BaseDiscordResponse {
|
||||
output: {
|
||||
message: string
|
||||
data?: {
|
||||
messages: DiscordMessage[]
|
||||
channel_id: string
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export interface DiscordGetServerResponse extends BaseDiscordResponse {
|
||||
output: {
|
||||
message: string
|
||||
data?: DiscordGuild
|
||||
}
|
||||
}
|
||||
|
||||
export interface DiscordGetUserResponse extends BaseDiscordResponse {
|
||||
output: {
|
||||
message: string
|
||||
data?: DiscordUser
|
||||
}
|
||||
}
|
||||
|
||||
// Message operations
|
||||
export interface DiscordEditMessageParams extends DiscordAuthParams {
|
||||
channelId: string
|
||||
messageId: string
|
||||
content?: string
|
||||
}
|
||||
|
||||
export interface DiscordEditMessageResponse extends BaseDiscordResponse {
|
||||
output: {
|
||||
message: string
|
||||
data?: DiscordMessage
|
||||
}
|
||||
}
|
||||
|
||||
export interface DiscordDeleteMessageParams extends DiscordAuthParams {
|
||||
channelId: string
|
||||
messageId: string
|
||||
}
|
||||
|
||||
export interface DiscordDeleteMessageResponse extends BaseDiscordResponse {
|
||||
output: {
|
||||
message: string
|
||||
}
|
||||
}
|
||||
|
||||
export interface DiscordAddReactionParams extends DiscordAuthParams {
|
||||
channelId: string
|
||||
messageId: string
|
||||
emoji: string
|
||||
}
|
||||
|
||||
export interface DiscordAddReactionResponse extends BaseDiscordResponse {
|
||||
output: {
|
||||
message: string
|
||||
}
|
||||
}
|
||||
|
||||
export interface DiscordRemoveReactionParams extends DiscordAuthParams {
|
||||
channelId: string
|
||||
messageId: string
|
||||
emoji: string
|
||||
userId?: string
|
||||
}
|
||||
|
||||
export interface DiscordRemoveReactionResponse extends BaseDiscordResponse {
|
||||
output: {
|
||||
message: string
|
||||
}
|
||||
}
|
||||
|
||||
export interface DiscordPinMessageParams extends DiscordAuthParams {
|
||||
channelId: string
|
||||
messageId: string
|
||||
}
|
||||
|
||||
export interface DiscordPinMessageResponse extends BaseDiscordResponse {
|
||||
output: {
|
||||
message: string
|
||||
}
|
||||
}
|
||||
|
||||
export interface DiscordUnpinMessageParams extends DiscordAuthParams {
|
||||
channelId: string
|
||||
messageId: string
|
||||
}
|
||||
|
||||
export interface DiscordUnpinMessageResponse extends BaseDiscordResponse {
|
||||
output: {
|
||||
message: string
|
||||
}
|
||||
}
|
||||
|
||||
// Thread operations
|
||||
export interface DiscordCreateThreadParams extends DiscordAuthParams {
|
||||
channelId: string
|
||||
name: string
|
||||
messageId?: string
|
||||
autoArchiveDuration?: number
|
||||
isPublic?: boolean
|
||||
}
|
||||
|
||||
export interface DiscordCreateThreadResponse extends BaseDiscordResponse {
|
||||
output: {
|
||||
message: string
|
||||
data?: any
|
||||
}
|
||||
}
|
||||
|
||||
export interface DiscordJoinThreadParams extends DiscordAuthParams {
|
||||
threadId: string
|
||||
}
|
||||
|
||||
export interface DiscordJoinThreadResponse extends BaseDiscordResponse {
|
||||
output: {
|
||||
message: string
|
||||
}
|
||||
}
|
||||
|
||||
export interface DiscordLeaveThreadParams extends DiscordAuthParams {
|
||||
threadId: string
|
||||
}
|
||||
|
||||
export interface DiscordLeaveThreadResponse extends BaseDiscordResponse {
|
||||
output: {
|
||||
message: string
|
||||
}
|
||||
}
|
||||
|
||||
export interface DiscordArchiveThreadParams extends DiscordAuthParams {
|
||||
threadId: string
|
||||
archived: boolean
|
||||
}
|
||||
|
||||
export interface DiscordArchiveThreadResponse extends BaseDiscordResponse {
|
||||
output: {
|
||||
message: string
|
||||
data?: any
|
||||
}
|
||||
}
|
||||
|
||||
// Channel operations
|
||||
export interface DiscordCreateChannelParams extends DiscordAuthParams {
|
||||
name: string
|
||||
type?: number
|
||||
topic?: string
|
||||
parentId?: string
|
||||
}
|
||||
|
||||
export interface DiscordCreateChannelResponse extends BaseDiscordResponse {
|
||||
output: {
|
||||
message: string
|
||||
data?: any
|
||||
}
|
||||
}
|
||||
|
||||
export interface DiscordUpdateChannelParams extends DiscordAuthParams {
|
||||
channelId: string
|
||||
name?: string
|
||||
topic?: string
|
||||
}
|
||||
|
||||
export interface DiscordUpdateChannelResponse extends BaseDiscordResponse {
|
||||
output: {
|
||||
message: string
|
||||
data?: any
|
||||
}
|
||||
}
|
||||
|
||||
export interface DiscordDeleteChannelParams extends DiscordAuthParams {
|
||||
channelId: string
|
||||
}
|
||||
|
||||
export interface DiscordDeleteChannelResponse extends BaseDiscordResponse {
|
||||
output: {
|
||||
message: string
|
||||
data?: any
|
||||
}
|
||||
}
|
||||
|
||||
export interface DiscordGetChannelParams extends DiscordAuthParams {
|
||||
channelId: string
|
||||
}
|
||||
|
||||
export interface DiscordGetChannelResponse extends BaseDiscordResponse {
|
||||
output: {
|
||||
message: string
|
||||
data?: any
|
||||
}
|
||||
}
|
||||
|
||||
// Role operations
|
||||
export interface DiscordCreateRoleParams extends DiscordAuthParams {
|
||||
name: string
|
||||
color?: number
|
||||
hoist?: boolean
|
||||
mentionable?: boolean
|
||||
}
|
||||
|
||||
export interface DiscordCreateRoleResponse extends BaseDiscordResponse {
|
||||
output: {
|
||||
message: string
|
||||
data?: any
|
||||
}
|
||||
}
|
||||
|
||||
export interface DiscordUpdateRoleParams extends DiscordAuthParams {
|
||||
roleId: string
|
||||
name?: string
|
||||
color?: number
|
||||
hoist?: boolean
|
||||
mentionable?: boolean
|
||||
}
|
||||
|
||||
export interface DiscordUpdateRoleResponse extends BaseDiscordResponse {
|
||||
output: {
|
||||
message: string
|
||||
data?: any
|
||||
}
|
||||
}
|
||||
|
||||
export interface DiscordDeleteRoleParams extends DiscordAuthParams {
|
||||
roleId: string
|
||||
}
|
||||
|
||||
export interface DiscordDeleteRoleResponse extends BaseDiscordResponse {
|
||||
output: {
|
||||
message: string
|
||||
}
|
||||
}
|
||||
|
||||
export interface DiscordAssignRoleParams extends DiscordAuthParams {
|
||||
userId: string
|
||||
roleId: string
|
||||
}
|
||||
|
||||
export interface DiscordAssignRoleResponse extends BaseDiscordResponse {
|
||||
output: {
|
||||
message: string
|
||||
}
|
||||
}
|
||||
|
||||
export interface DiscordRemoveRoleParams extends DiscordAuthParams {
|
||||
userId: string
|
||||
roleId: string
|
||||
}
|
||||
|
||||
export interface DiscordRemoveRoleResponse extends BaseDiscordResponse {
|
||||
output: {
|
||||
message: string
|
||||
}
|
||||
}
|
||||
|
||||
// Member operations
|
||||
export interface DiscordKickMemberParams extends DiscordAuthParams {
|
||||
userId: string
|
||||
reason?: string
|
||||
}
|
||||
|
||||
export interface DiscordKickMemberResponse extends BaseDiscordResponse {
|
||||
output: {
|
||||
message: string
|
||||
}
|
||||
}
|
||||
|
||||
export interface DiscordBanMemberParams extends DiscordAuthParams {
|
||||
userId: string
|
||||
reason?: string
|
||||
deleteMessageSeconds?: number
|
||||
}
|
||||
|
||||
export interface DiscordBanMemberResponse extends BaseDiscordResponse {
|
||||
output: {
|
||||
message: string
|
||||
}
|
||||
}
|
||||
|
||||
export interface DiscordUnbanMemberParams extends DiscordAuthParams {
|
||||
userId: string
|
||||
reason?: string
|
||||
}
|
||||
|
||||
export interface DiscordUnbanMemberResponse extends BaseDiscordResponse {
|
||||
output: {
|
||||
message: string
|
||||
}
|
||||
}
|
||||
|
||||
export interface DiscordGetMemberParams extends DiscordAuthParams {
|
||||
userId: string
|
||||
}
|
||||
|
||||
export interface DiscordGetMemberResponse extends BaseDiscordResponse {
|
||||
output: {
|
||||
message: string
|
||||
data?: any
|
||||
}
|
||||
}
|
||||
|
||||
export interface DiscordUpdateMemberParams extends DiscordAuthParams {
|
||||
userId: string
|
||||
nick?: string
|
||||
mute?: boolean
|
||||
deaf?: boolean
|
||||
}
|
||||
|
||||
export interface DiscordUpdateMemberResponse extends BaseDiscordResponse {
|
||||
output: {
|
||||
message: string
|
||||
data?: any
|
||||
}
|
||||
}
|
||||
|
||||
// Invite operations
|
||||
export interface DiscordCreateInviteParams extends DiscordAuthParams {
|
||||
channelId: string
|
||||
maxAge?: number
|
||||
maxUses?: number
|
||||
temporary?: boolean
|
||||
}
|
||||
|
||||
export interface DiscordCreateInviteResponse extends BaseDiscordResponse {
|
||||
output: {
|
||||
message: string
|
||||
data?: any
|
||||
}
|
||||
}
|
||||
|
||||
export interface DiscordGetInviteParams extends DiscordAuthParams {
|
||||
inviteCode: string
|
||||
}
|
||||
|
||||
export interface DiscordGetInviteResponse extends BaseDiscordResponse {
|
||||
output: {
|
||||
message: string
|
||||
data?: any
|
||||
}
|
||||
}
|
||||
|
||||
export interface DiscordDeleteInviteParams extends DiscordAuthParams {
|
||||
inviteCode: string
|
||||
}
|
||||
|
||||
export interface DiscordDeleteInviteResponse extends BaseDiscordResponse {
|
||||
output: {
|
||||
message: string
|
||||
}
|
||||
}
|
||||
|
||||
// Webhook operations
|
||||
export interface DiscordCreateWebhookParams extends DiscordAuthParams {
|
||||
channelId: string
|
||||
name: string
|
||||
}
|
||||
|
||||
export interface DiscordCreateWebhookResponse extends BaseDiscordResponse {
|
||||
output: {
|
||||
message: string
|
||||
data?: any
|
||||
}
|
||||
}
|
||||
|
||||
export interface DiscordExecuteWebhookParams extends DiscordAuthParams {
|
||||
webhookId: string
|
||||
webhookToken: string
|
||||
content: string
|
||||
username?: string
|
||||
}
|
||||
|
||||
export interface DiscordExecuteWebhookResponse extends BaseDiscordResponse {
|
||||
output: {
|
||||
message: string
|
||||
data?: any
|
||||
}
|
||||
}
|
||||
|
||||
export interface DiscordGetWebhookParams extends DiscordAuthParams {
|
||||
webhookId: string
|
||||
}
|
||||
|
||||
export interface DiscordGetWebhookResponse extends BaseDiscordResponse {
|
||||
output: {
|
||||
message: string
|
||||
data?: any
|
||||
}
|
||||
}
|
||||
|
||||
export interface DiscordDeleteWebhookParams extends DiscordAuthParams {
|
||||
webhookId: string
|
||||
}
|
||||
|
||||
export interface DiscordDeleteWebhookResponse extends BaseDiscordResponse {
|
||||
output: {
|
||||
message: string
|
||||
}
|
||||
}
|
||||
|
||||
// Channel / role listing operations
|
||||
export type DiscordListChannelsParams = DiscordAuthParams
|
||||
|
||||
export interface DiscordListChannelsResponse extends BaseDiscordResponse {
|
||||
output: {
|
||||
message: string
|
||||
data?: any[]
|
||||
}
|
||||
}
|
||||
|
||||
export type DiscordListRolesParams = DiscordAuthParams
|
||||
|
||||
export interface DiscordListRolesResponse extends BaseDiscordResponse {
|
||||
output: {
|
||||
message: string
|
||||
data?: any[]
|
||||
}
|
||||
}
|
||||
|
||||
export interface DiscordGetPinnedMessagesParams extends DiscordAuthParams {
|
||||
channelId: string
|
||||
limit?: number
|
||||
before?: string
|
||||
}
|
||||
|
||||
export interface DiscordGetPinnedMessagesResponse extends BaseDiscordResponse {
|
||||
output: {
|
||||
message: string
|
||||
data?: Array<DiscordMessage & { pinned_at: string }>
|
||||
hasMore?: boolean
|
||||
}
|
||||
}
|
||||
|
||||
export interface DiscordBulkDeleteMessagesParams extends DiscordAuthParams {
|
||||
channelId: string
|
||||
messageIds: string[]
|
||||
}
|
||||
|
||||
export interface DiscordBulkDeleteMessagesResponse extends BaseDiscordResponse {
|
||||
output: {
|
||||
message: string
|
||||
}
|
||||
}
|
||||
|
||||
export type DiscordResponse =
|
||||
| DiscordSendMessageResponse
|
||||
| DiscordGetMessagesResponse
|
||||
| DiscordGetServerResponse
|
||||
| DiscordGetUserResponse
|
||||
| DiscordEditMessageResponse
|
||||
| DiscordDeleteMessageResponse
|
||||
| DiscordAddReactionResponse
|
||||
| DiscordRemoveReactionResponse
|
||||
| DiscordPinMessageResponse
|
||||
| DiscordUnpinMessageResponse
|
||||
| DiscordCreateThreadResponse
|
||||
| DiscordJoinThreadResponse
|
||||
| DiscordLeaveThreadResponse
|
||||
| DiscordArchiveThreadResponse
|
||||
| DiscordCreateChannelResponse
|
||||
| DiscordUpdateChannelResponse
|
||||
| DiscordDeleteChannelResponse
|
||||
| DiscordGetChannelResponse
|
||||
| DiscordCreateRoleResponse
|
||||
| DiscordUpdateRoleResponse
|
||||
| DiscordDeleteRoleResponse
|
||||
| DiscordAssignRoleResponse
|
||||
| DiscordRemoveRoleResponse
|
||||
| DiscordKickMemberResponse
|
||||
| DiscordBanMemberResponse
|
||||
| DiscordUnbanMemberResponse
|
||||
| DiscordGetMemberResponse
|
||||
| DiscordUpdateMemberResponse
|
||||
| DiscordCreateInviteResponse
|
||||
| DiscordGetInviteResponse
|
||||
| DiscordDeleteInviteResponse
|
||||
| DiscordCreateWebhookResponse
|
||||
| DiscordExecuteWebhookResponse
|
||||
| DiscordGetWebhookResponse
|
||||
| DiscordDeleteWebhookResponse
|
||||
| DiscordListChannelsResponse
|
||||
| DiscordListRolesResponse
|
||||
| DiscordGetPinnedMessagesResponse
|
||||
| DiscordBulkDeleteMessagesResponse
|
||||
@@ -0,0 +1,68 @@
|
||||
import type { DiscordUnbanMemberParams, DiscordUnbanMemberResponse } from '@/tools/discord/types'
|
||||
import type { ToolConfig } from '@/tools/types'
|
||||
|
||||
export const discordUnbanMemberTool: ToolConfig<
|
||||
DiscordUnbanMemberParams,
|
||||
DiscordUnbanMemberResponse
|
||||
> = {
|
||||
id: 'discord_unban_member',
|
||||
name: 'Discord Unban Member',
|
||||
description: 'Unban a member from a Discord server',
|
||||
version: '1.0.0',
|
||||
|
||||
params: {
|
||||
botToken: {
|
||||
type: 'string',
|
||||
required: true,
|
||||
visibility: 'user-only',
|
||||
description: 'The bot token for authentication',
|
||||
},
|
||||
serverId: {
|
||||
type: 'string',
|
||||
required: true,
|
||||
visibility: 'user-or-llm',
|
||||
description: 'The Discord server ID (guild ID), e.g., 123456789012345678',
|
||||
},
|
||||
userId: {
|
||||
type: 'string',
|
||||
required: true,
|
||||
visibility: 'user-or-llm',
|
||||
description: 'The user ID to unban, e.g., 123456789012345678',
|
||||
},
|
||||
reason: {
|
||||
type: 'string',
|
||||
required: false,
|
||||
visibility: 'user-or-llm',
|
||||
description: 'Reason for unbanning the member',
|
||||
},
|
||||
},
|
||||
|
||||
request: {
|
||||
url: (params: DiscordUnbanMemberParams) => {
|
||||
return `https://discord.com/api/v10/guilds/${params.serverId.trim()}/bans/${params.userId.trim()}`
|
||||
},
|
||||
method: 'DELETE',
|
||||
headers: (params) => {
|
||||
const headers: Record<string, string> = {
|
||||
Authorization: `Bot ${params.botToken.trim()}`,
|
||||
}
|
||||
if (params.reason) {
|
||||
headers['X-Audit-Log-Reason'] = encodeURIComponent(params.reason)
|
||||
}
|
||||
return headers
|
||||
},
|
||||
},
|
||||
|
||||
transformResponse: async (response) => {
|
||||
return {
|
||||
success: true,
|
||||
output: {
|
||||
message: 'Member unbanned successfully',
|
||||
},
|
||||
}
|
||||
},
|
||||
|
||||
outputs: {
|
||||
message: { type: 'string', description: 'Success or error message' },
|
||||
},
|
||||
}
|
||||
@@ -0,0 +1,62 @@
|
||||
import type { DiscordUnpinMessageParams, DiscordUnpinMessageResponse } from '@/tools/discord/types'
|
||||
import type { ToolConfig } from '@/tools/types'
|
||||
|
||||
export const discordUnpinMessageTool: ToolConfig<
|
||||
DiscordUnpinMessageParams,
|
||||
DiscordUnpinMessageResponse
|
||||
> = {
|
||||
id: 'discord_unpin_message',
|
||||
name: 'Discord Unpin Message',
|
||||
description: 'Unpin a message in a Discord channel',
|
||||
version: '1.0.0',
|
||||
|
||||
params: {
|
||||
botToken: {
|
||||
type: 'string',
|
||||
required: true,
|
||||
visibility: 'user-only',
|
||||
description: 'The bot token for authentication',
|
||||
},
|
||||
channelId: {
|
||||
type: 'string',
|
||||
required: true,
|
||||
visibility: 'user-or-llm',
|
||||
description: 'The Discord channel ID containing the message, e.g., 123456789012345678',
|
||||
},
|
||||
messageId: {
|
||||
type: 'string',
|
||||
required: true,
|
||||
visibility: 'user-or-llm',
|
||||
description: 'The ID of the message to unpin, e.g., 123456789012345678',
|
||||
},
|
||||
serverId: {
|
||||
type: 'string',
|
||||
required: true,
|
||||
visibility: 'user-or-llm',
|
||||
description: 'The Discord server ID (guild ID), e.g., 123456789012345678',
|
||||
},
|
||||
},
|
||||
|
||||
request: {
|
||||
url: (params: DiscordUnpinMessageParams) => {
|
||||
return `https://discord.com/api/v10/channels/${params.channelId.trim()}/pins/${params.messageId.trim()}`
|
||||
},
|
||||
method: 'DELETE',
|
||||
headers: (params) => ({
|
||||
Authorization: `Bot ${params.botToken.trim()}`,
|
||||
}),
|
||||
},
|
||||
|
||||
transformResponse: async (response) => {
|
||||
return {
|
||||
success: true,
|
||||
output: {
|
||||
message: 'Message unpinned successfully',
|
||||
},
|
||||
}
|
||||
},
|
||||
|
||||
outputs: {
|
||||
message: { type: 'string', description: 'Success or error message' },
|
||||
},
|
||||
}
|
||||
@@ -0,0 +1,92 @@
|
||||
import type {
|
||||
DiscordUpdateChannelParams,
|
||||
DiscordUpdateChannelResponse,
|
||||
} from '@/tools/discord/types'
|
||||
import type { ToolConfig } from '@/tools/types'
|
||||
|
||||
export const discordUpdateChannelTool: ToolConfig<
|
||||
DiscordUpdateChannelParams,
|
||||
DiscordUpdateChannelResponse
|
||||
> = {
|
||||
id: 'discord_update_channel',
|
||||
name: 'Discord Update Channel',
|
||||
description: 'Update a Discord channel',
|
||||
version: '1.0.0',
|
||||
|
||||
params: {
|
||||
botToken: {
|
||||
type: 'string',
|
||||
required: true,
|
||||
visibility: 'user-only',
|
||||
description: 'The bot token for authentication',
|
||||
},
|
||||
channelId: {
|
||||
type: 'string',
|
||||
required: true,
|
||||
visibility: 'user-or-llm',
|
||||
description: 'The Discord channel ID to update, e.g., 123456789012345678',
|
||||
},
|
||||
name: {
|
||||
type: 'string',
|
||||
required: false,
|
||||
visibility: 'user-or-llm',
|
||||
description: 'The new name for the channel',
|
||||
},
|
||||
topic: {
|
||||
type: 'string',
|
||||
required: false,
|
||||
visibility: 'user-or-llm',
|
||||
description: 'The new topic for the channel',
|
||||
},
|
||||
serverId: {
|
||||
type: 'string',
|
||||
required: true,
|
||||
visibility: 'user-or-llm',
|
||||
description: 'The Discord server ID (guild ID), e.g., 123456789012345678',
|
||||
},
|
||||
},
|
||||
|
||||
request: {
|
||||
url: (params: DiscordUpdateChannelParams) => {
|
||||
return `https://discord.com/api/v10/channels/${params.channelId.trim()}`
|
||||
},
|
||||
method: 'PATCH',
|
||||
headers: (params) => ({
|
||||
'Content-Type': 'application/json',
|
||||
Authorization: `Bot ${params.botToken.trim()}`,
|
||||
}),
|
||||
body: (params: DiscordUpdateChannelParams) => {
|
||||
const body: any = {}
|
||||
if (params.name !== undefined && params.name !== null && params.name !== '')
|
||||
body.name = params.name
|
||||
if (params.topic !== undefined && params.topic !== null && params.topic !== '')
|
||||
body.topic = params.topic
|
||||
return body
|
||||
},
|
||||
},
|
||||
|
||||
transformResponse: async (response) => {
|
||||
const data = await response.json()
|
||||
return {
|
||||
success: true,
|
||||
output: {
|
||||
message: 'Channel updated successfully',
|
||||
data,
|
||||
},
|
||||
}
|
||||
},
|
||||
|
||||
outputs: {
|
||||
message: { type: 'string', description: 'Success or error message' },
|
||||
data: {
|
||||
type: 'object',
|
||||
description: 'Updated channel data',
|
||||
properties: {
|
||||
id: { type: 'string', description: 'Channel ID' },
|
||||
name: { type: 'string', description: 'Channel name' },
|
||||
type: { type: 'number', description: 'Channel type' },
|
||||
topic: { type: 'string', description: 'Channel topic' },
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
@@ -0,0 +1,94 @@
|
||||
import type { DiscordUpdateMemberParams, DiscordUpdateMemberResponse } from '@/tools/discord/types'
|
||||
import type { ToolConfig } from '@/tools/types'
|
||||
|
||||
export const discordUpdateMemberTool: ToolConfig<
|
||||
DiscordUpdateMemberParams,
|
||||
DiscordUpdateMemberResponse
|
||||
> = {
|
||||
id: 'discord_update_member',
|
||||
name: 'Discord Update Member',
|
||||
description: 'Update a member in a Discord server (e.g., change nickname)',
|
||||
version: '1.0.0',
|
||||
|
||||
params: {
|
||||
botToken: {
|
||||
type: 'string',
|
||||
required: true,
|
||||
visibility: 'user-only',
|
||||
description: 'The bot token for authentication',
|
||||
},
|
||||
serverId: {
|
||||
type: 'string',
|
||||
required: true,
|
||||
visibility: 'user-or-llm',
|
||||
description: 'The Discord server ID (guild ID), e.g., 123456789012345678',
|
||||
},
|
||||
userId: {
|
||||
type: 'string',
|
||||
required: true,
|
||||
visibility: 'user-or-llm',
|
||||
description: 'The user ID to update, e.g., 123456789012345678',
|
||||
},
|
||||
nick: {
|
||||
type: 'string',
|
||||
required: false,
|
||||
visibility: 'user-or-llm',
|
||||
description: 'New nickname for the member (null to remove)',
|
||||
},
|
||||
mute: {
|
||||
type: 'boolean',
|
||||
required: false,
|
||||
visibility: 'user-or-llm',
|
||||
description: 'Whether to mute the member in voice channels',
|
||||
},
|
||||
deaf: {
|
||||
type: 'boolean',
|
||||
required: false,
|
||||
visibility: 'user-or-llm',
|
||||
description: 'Whether to deafen the member in voice channels',
|
||||
},
|
||||
},
|
||||
|
||||
request: {
|
||||
url: (params: DiscordUpdateMemberParams) => {
|
||||
return `https://discord.com/api/v10/guilds/${params.serverId.trim()}/members/${params.userId.trim()}`
|
||||
},
|
||||
method: 'PATCH',
|
||||
headers: (params) => ({
|
||||
'Content-Type': 'application/json',
|
||||
Authorization: `Bot ${params.botToken.trim()}`,
|
||||
}),
|
||||
body: (params: DiscordUpdateMemberParams) => {
|
||||
const body: any = {}
|
||||
// Note: nick can be null to remove nickname, so we allow null but not empty string
|
||||
if (params.nick !== undefined && params.nick !== '') body.nick = params.nick
|
||||
if (params.mute !== undefined && params.mute !== null) body.mute = params.mute
|
||||
if (params.deaf !== undefined && params.deaf !== null) body.deaf = params.deaf
|
||||
return body
|
||||
},
|
||||
},
|
||||
|
||||
transformResponse: async (response) => {
|
||||
const data = await response.json()
|
||||
return {
|
||||
success: true,
|
||||
output: {
|
||||
message: 'Member updated successfully',
|
||||
data,
|
||||
},
|
||||
}
|
||||
},
|
||||
|
||||
outputs: {
|
||||
message: { type: 'string', description: 'Success or error message' },
|
||||
data: {
|
||||
type: 'object',
|
||||
description: 'Updated member data',
|
||||
properties: {
|
||||
nick: { type: 'string', description: 'Server nickname' },
|
||||
mute: { type: 'boolean', description: 'Voice mute status' },
|
||||
deaf: { type: 'boolean', description: 'Voice deaf status' },
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
@@ -0,0 +1,98 @@
|
||||
import type { DiscordUpdateRoleParams, DiscordUpdateRoleResponse } from '@/tools/discord/types'
|
||||
import type { ToolConfig } from '@/tools/types'
|
||||
|
||||
export const discordUpdateRoleTool: ToolConfig<DiscordUpdateRoleParams, DiscordUpdateRoleResponse> =
|
||||
{
|
||||
id: 'discord_update_role',
|
||||
name: 'Discord Update Role',
|
||||
description: 'Update a role in a Discord server',
|
||||
version: '1.0.0',
|
||||
|
||||
params: {
|
||||
botToken: {
|
||||
type: 'string',
|
||||
required: true,
|
||||
visibility: 'user-only',
|
||||
description: 'The bot token for authentication',
|
||||
},
|
||||
serverId: {
|
||||
type: 'string',
|
||||
required: true,
|
||||
visibility: 'user-or-llm',
|
||||
description: 'The Discord server ID (guild ID), e.g., 123456789012345678',
|
||||
},
|
||||
roleId: {
|
||||
type: 'string',
|
||||
required: true,
|
||||
visibility: 'user-or-llm',
|
||||
description: 'The role ID to update, e.g., 123456789012345678',
|
||||
},
|
||||
name: {
|
||||
type: 'string',
|
||||
required: false,
|
||||
visibility: 'user-or-llm',
|
||||
description: 'The new name for the role',
|
||||
},
|
||||
color: {
|
||||
type: 'number',
|
||||
required: false,
|
||||
visibility: 'user-or-llm',
|
||||
description: 'RGB color value as integer',
|
||||
},
|
||||
hoist: {
|
||||
type: 'boolean',
|
||||
required: false,
|
||||
visibility: 'user-or-llm',
|
||||
description: 'Whether to display role members separately',
|
||||
},
|
||||
mentionable: {
|
||||
type: 'boolean',
|
||||
required: false,
|
||||
visibility: 'user-or-llm',
|
||||
description: 'Whether the role can be mentioned',
|
||||
},
|
||||
},
|
||||
|
||||
request: {
|
||||
url: (params: DiscordUpdateRoleParams) => {
|
||||
return `https://discord.com/api/v10/guilds/${params.serverId.trim()}/roles/${params.roleId.trim()}`
|
||||
},
|
||||
method: 'PATCH',
|
||||
headers: (params) => ({
|
||||
'Content-Type': 'application/json',
|
||||
Authorization: `Bot ${params.botToken.trim()}`,
|
||||
}),
|
||||
body: (params: DiscordUpdateRoleParams) => {
|
||||
const body: any = {}
|
||||
if (params.name) body.name = params.name
|
||||
if (params.color !== undefined) body.color = Number(params.color)
|
||||
if (params.hoist !== undefined) body.hoist = params.hoist
|
||||
if (params.mentionable !== undefined) body.mentionable = params.mentionable
|
||||
return body
|
||||
},
|
||||
},
|
||||
|
||||
transformResponse: async (response) => {
|
||||
const data = await response.json()
|
||||
return {
|
||||
success: true,
|
||||
output: {
|
||||
message: 'Role updated successfully',
|
||||
data,
|
||||
},
|
||||
}
|
||||
},
|
||||
|
||||
outputs: {
|
||||
message: { type: 'string', description: 'Success or error message' },
|
||||
data: {
|
||||
type: 'object',
|
||||
description: 'Updated role data',
|
||||
properties: {
|
||||
id: { type: 'string', description: 'Role ID' },
|
||||
name: { type: 'string', description: 'Role name' },
|
||||
color: { type: 'number', description: 'Role color' },
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
Reference in New Issue
Block a user