Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/mcp-handler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ export function initializeMcpServer(server: any, config: McpConfig = {}) {
}

// Register prompts to help users get started
server.prompt("web_search_help", "Get help with web search using Exa", {}, async () => {
server.prompt("web_search_help", "Get help with web search using Exa", async () => {
return {
messages: [
{
Expand Down
30 changes: 30 additions & 0 deletions tests/unit/mcp-handler.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { beforeEach, describe, expect, it, vi } from "vitest";
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
import { initializeMcpServer } from "../../src/mcp-handler.js";
import { FakeMcpServer } from "../helpers/fakeMcpServer.js";

Expand Down Expand Up @@ -44,6 +45,35 @@ describe("initializeMcpServer", () => {
);
});

it("accepts prompts/get for web_search_help when arguments are omitted", async () => {
const server = new McpServer({ name: "test-server", version: "1.0.0" });

initializeMcpServer(server);

const getPromptHandler = (server.server as any)._requestHandlers.get("prompts/get");
const result = await getPromptHandler(
{
method: "prompts/get",
params: {
name: "web_search_help",
},
},
{ signal: new AbortController().signal },
);

expect(result).toMatchObject({
messages: [
{
role: "user",
content: {
type: "text",
text: expect.stringContaining("search the web"),
},
},
],
});
});

it("respects explicit tool selection and deprecated aliases", () => {
const server = new FakeMcpServer();

Expand Down
Loading