Skip to main content
Glama

Github Project Manager

base-slack-tool.ts1.66 kB
import { WebClient } from '@slack/web-api'; import { SlackApiError } from '../errors/slack-api-error.js'; /** * Base class for Slack tools */ export class BaseSlackTool { /** * Create a new BaseSlackTool instance * * @param client - The authenticated Slack WebClient * @param teamId - The Slack team ID */ constructor( protected readonly client: WebClient, protected readonly teamId: string, ) {} /** * Create a response object with text content * * @param text - The text content * @returns A formatted response object */ protected createResponse(text: string) { return { content: [ { type: 'text' as const, text, }, ], }; } /** * Create a structured response with message data * * @param data - The data to format * @returns A formatted response object */ protected createStructuredResponse(data: unknown) { return { content: [ { type: 'text' as const, text: JSON.stringify(data, null, 2), }, ], }; } /** * Handle API errors uniformly * * @param error - The caught error * @param operation - The operation that failed * @throws SlackApiError with formatted message */ protected handleError(error: unknown, operation: string): never { throw new SlackApiError(`Failed to ${operation}: ${error instanceof Error ? error.message : String(error)}`); } }

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/Monsoft-Solutions/model-context-protocols'

If you have feedback or need assistance with the MCP directory API, please join our Discord server