Skip to main content
Glama
ping.test.ts2.19 kB
import { describe, it, beforeEach, afterEach } from "mocha"; import { expect } from "chai"; import { createMcpServer } from "../../src/server/index"; import { McpTestFixture } from "../fixtures/mcpTestFixture"; describe("MCP Ping", () => { let fixture: McpTestFixture; beforeEach(async () => { fixture = new McpTestFixture(); await fixture.setup(); }); afterEach(async () => { if (fixture) { await fixture.teardown(); } }); it("should handle MCP ping request", async () => { const server = createMcpServer(); // Test that server is created successfully expect(server).to.be.an("object"); expect(server.server).to.be.an("object"); }); it("should have ping handler registered", async () => { const server = createMcpServer(); // Test that server is created successfully expect(server).to.be.an("object"); expect(server.server).to.be.an("object"); // The fact that createMcpServer() completes without error // indicates the ping handler was registered successfully }); it("should include ping in server capabilities", async () => { const server = createMcpServer(); // Test that server was created without errors expect(server).to.be.an("object"); expect(server.server).to.be.an("object"); // The ping handler should be registered internally // We can verify this by checking that the server creation completed // which means all handlers including ping were registered successfully expect(typeof server.connect).to.equal("function"); // The server should have the capability to handle ping requests // This is verified by the successful completion of createMcpServer() // which includes the ping handler registration }); it("should respond to ping using createMcpServer directly", async function() { const { client } = fixture.getContext(); // Send ping request using the client const { z } = await import("zod"); const result = await client.request({ method: "ping", params: {} }, z.object({})); // Verify ping response expect(result).to.be.an("object"); expect(result).to.deep.equal({}); }); });

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/zillow/auto-mobile'

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