Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 6599e81

Browse files
list prompt and get prompt
1 parent ea8778c commit 6599e81

File tree

1 file changed

+71
-0
lines changed

1 file changed

+71
-0
lines changed

‎index.ts

Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js"
44
import { VERSION } from "./common/version.js";
55
import {
66
CallToolRequestSchema,
7+
GetPromptRequestSchema,
8+
ListPromptsRequestSchema,
79
ListToolsRequestSchema,
810
} from "@modelcontextprotocol/sdk/types.js";
911
import { zodToJsonSchema } from "zod-to-json-schema";
@@ -25,10 +27,79 @@ const server = new Server(
2527
{
2628
capabilities: {
2729
tools: {},
30+
prompts: {},
2831
},
2932
},
3033
);
3134

35+
enum PromptName {
36+
LIST_MEETINGS = "list_meetings",
37+
CREATE_A_MEETING = "create_meeting",
38+
DELETE_A_MEETING = "delete_a_meeting",
39+
}
40+
41+
server.setRequestHandler(ListPromptsRequestSchema, async () => {
42+
return {
43+
prompts: [
44+
{
45+
name: PromptName.LIST_MEETINGS,
46+
description: "A prompt to list meetings",
47+
},
48+
{
49+
name: PromptName.CREATE_A_MEETING,
50+
description: "A prompt to create a meeting",
51+
},
52+
{
53+
name: PromptName.DELETE_A_MEETING,
54+
description: "A prompt to delete a meeting",
55+
},
56+
],
57+
};
58+
});
59+
60+
server.setRequestHandler(GetPromptRequestSchema, async (request) => {
61+
const { name, arguments: args } = request.params;
62+
63+
if (name === PromptName.LIST_MEETINGS) {
64+
return {
65+
messages: [
66+
{
67+
role: "user",
68+
content: {
69+
type: "text",
70+
text: "List my zoom meetings",
71+
},
72+
},
73+
],
74+
};
75+
} else if (name === PromptName.CREATE_A_MEETING) {
76+
return {
77+
messages: [
78+
{
79+
role: "user",
80+
content: {
81+
type: "text",
82+
text: "Create a zoom meeting",
83+
},
84+
},
85+
],
86+
};
87+
} else if (name === PromptName.DELETE_A_MEETING) {
88+
return {
89+
messages: [
90+
{
91+
role: "user",
92+
content: {
93+
type: "text",
94+
text: "Delete a zoom meeting",
95+
},
96+
},
97+
],
98+
};
99+
}
100+
throw new Error(`Unknown prompt: ${name}`);
101+
});
102+
32103
server.setRequestHandler(ListToolsRequestSchema, async () => {
33104
return {
34105
tools: [

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /