Skip to main content
Glama

MCP Evolution API

by aiteks-ltda
index.ts1.3 kB
import type { ToolRegistration } from "@/types"; import { makeJsonSchema } from "@/utils/makeJsonSchema"; import { type SomeFunctionSchema, someFunctionSchema } from "./schema"; // Simulate an async operation const asyncOperation = (ms: number) => new Promise((resolve) => setTimeout(resolve, ms)); export const someFunction = async ( args: SomeFunctionSchema, ): Promise<string> => { try { await asyncOperation(100); // Simulate async work return `Hello ${args.name}`; } catch (error) { console.error("Error in someFunction:", error); throw new Error(`Failed to process name: ${(error as Error).message}`); } }; export const someFunctionTool: ToolRegistration<SomeFunctionSchema> = { name: "some_function", description: "An example tool", inputSchema: makeJsonSchema(someFunctionSchema), handler: async (args: SomeFunctionSchema) => { try { const parsedArgs = someFunctionSchema.parse(args); const result = await someFunction(parsedArgs); return { content: [ { type: "text", text: result, }, ], }; } catch (error) { console.error("Error in someFunctionTool handler:", error); return { content: [ { type: "text", text: `Error: ${(error as Error).message}`, }, ], isError: true, }; } }, };

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/aiteks-ltda/mcp-evolution-whatsapp-api'

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