-
-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathbaseline-mcp-server.test.ts
More file actions
56 lines (52 loc) · 1.58 KB
/
Copy pathbaseline-mcp-server.test.ts
File metadata and controls
56 lines (52 loc) · 1.58 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
import { Client, InMemoryTransport } from "@modelcontextprotocol/client";
import { assertEquals } from "@std/assert";
import { createMCPServer } from "./baseline-mcp-server.ts";
Deno.test("MCPサーバーがツールと入力スキーマを公開する", async () => {
const server = createMCPServer();
const client = new Client({
name: "baseline-mcp-server-test",
version: "1.0.0",
});
const [clientTransport, serverTransport] = InMemoryTransport
.createLinkedPair();
await server.connect(serverTransport);
await client.connect(clientTransport);
try {
const { tools } = await client.listTools();
assertEquals(
tools.map(({ name }) => name),
[
"get_web_feature_baseline_status",
"get_negated_browser_baseline_status",
],
);
assertEquals(tools[0].inputSchema, {
$schema: "https://json-schema.org/draft/2020-12/schema",
type: "object",
properties: {
query: {
description: "調べたい機能の名前",
type: "array",
items: { type: "string" },
},
},
required: ["query"],
});
assertEquals(tools[1].inputSchema, {
$schema: "https://json-schema.org/draft/2020-12/schema",
type: "object",
properties: {
query: {
description:
"除外したいブラウザの名前(chrome, edge, firefox, safari)",
type: "string",
enum: ["chrome", "edge", "firefox", "safari"],
},
},
required: ["query"],
});
} finally {
await client.close();
await server.close();
}
});