Skip to main content
Glama
mcp.ts1.23 kB
import { z } from 'zod' import { type ToolCallback } from '@modelcontextprotocol/sdk/server/mcp.js' import { type ToolAnnotations } from '@modelcontextprotocol/sdk/types.js' 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 callback: ToolCallback<z.ZodRawShape> annotations?: ToolAnnotations } export class AgentMailToolkit extends ListToolkit<McpTool> { protected buildTool(tool: Tool): McpTool { const title = tool.name .split('_') .map((word) => word.charAt(0).toUpperCase() + word.slice(1)) .join(' ') return { name: tool.name, title, description: tool.description, inputSchema: tool.paramsSchema.shape, callback: 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 } }, annotations: { title, ...tool.annotations }, } } }

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