Skip to main content
Glama
tools.integration.test.ts2.14 kB
import { afterEach, beforeEach, describe, expect, it } from "vitest"; import { createMcpClient } from "./test-utils/mcp-client"; let mcpClient: ReturnType<typeof createMcpClient>["mcpClient"] | undefined; let stdioTransport: ReturnType<typeof createMcpClient>["stdioTransport"] | undefined; const getClient = () => { if (!mcpClient) { throw new Error("MCP client not initialized"); } return mcpClient; }; describe("Tools", () => { beforeEach(async () => { ({ mcpClient, stdioTransport } = createMcpClient()); await mcpClient.connect(stdioTransport); }); afterEach(async () => { await mcpClient?.close(); await stdioTransport?.close(); mcpClient = undefined; stdioTransport = undefined; }); describe("Tool Registration", () => { it("should have all expected tools registered", async () => { const { tools } = await getClient().listTools(); const MCPToolsNames = tools.map(tool => tool.name); const expectedTools = [ "manage_apps", "manage_keysets", "get_sdk_documentation", "get_chat_sdk_documentation", "how_to", "get_best_practices", "manage_app_context", "send_pubnub_message", "get_pubnub_presence", "subscribe_and_receive_pubnub_messages", "get_pubnub_messages", ]; expect(tools).toBeDefined(); expect(tools.length).toBe(11); expect(MCPToolsNames).toEqual(expectedTools); }); it("should have input schemas for tools that require arguments", async () => { const { tools } = await getClient().listTools(); const toolsWithInputs = [ "manage_apps", "manage_keysets", "get_sdk_documentation", "get_chat_sdk_documentation", "send_pubnub_message", "get_pubnub_presence", "manage_app_context", "subscribe_and_receive_pubnub_messages", "get_pubnub_messages", "how_to", ]; for (const toolName of toolsWithInputs) { const tool = tools.find(t => t.name === toolName); expect(tool?.inputSchema).toBeDefined(); } }); }); });

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/pubnub/pubnub-mcp-server'

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