Skip to main content
Glama
mcp.ts1.08 kB
import { type CallToolResult } from '@modelcontextprotocol/sdk/types.js' import { z } from 'zod' import { ListToolkit } from './toolkit.js' import { type Tool } from './tools.js' import { safeFunc } from './util.js' interface McpTool { name: string title: string description: string inputSchema: z.ZodRawShape cb: (args: Record<string, unknown>) => Promise<CallToolResult> } export class AgentMailToolkit extends ListToolkit<McpTool> { protected buildTool(tool: Tool): McpTool { return { name: tool.name, title: tool.name .split('_') .map((word) => word.charAt(0).toUpperCase() + word.slice(1)) .join(' '), description: tool.description, inputSchema: tool.params_schema.shape, cb: async (args) => { const { isError, result } = await safeFunc(tool.func, this.client, args) return { content: [{ type: 'text' as const, text: JSON.stringify(result, null, 2) }], isError } }, } } }

Latest Blog Posts

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/agentmail-to/agentmail-toolkit'

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