@@ -13,83 +13,17 @@ const getServer = () => {
13
13
version : '1.0.0' ,
14
14
} , { capabilities : { logging : { } } } ) ;
15
15
16
- // Register a simple tool that returns a greeting
17
- server . tool (
18
- 'greet' ,
19
- 'A simple greeting tool' ,
20
- {
21
- name : z . string ( ) . describe ( 'Name to greet' ) ,
22
- } ,
23
- async ( { name } ) : Promise < CallToolResult > => {
24
- return {
25
- content : [
26
- {
27
- type : 'text' ,
28
- text : `Hello, ${ name } !` ,
29
- } ,
30
- ] ,
31
- } ;
32
- }
33
- ) ;
34
-
35
- // Register a tool that sends multiple greetings with notifications (with annotations)
36
- server . tool (
37
- 'multi-greet' ,
38
- 'A tool that sends different greetings with delays between them' ,
39
- {
40
- name : z . string ( ) . describe ( 'Name to greet' ) ,
41
- } ,
42
- {
43
- title : 'Multiple Greeting Tool' ,
44
- readOnlyHint : true ,
45
- openWorldHint : false
46
- } ,
47
- async ( { name } , { sendNotification } ) : Promise < CallToolResult > => {
48
- const sleep = ( ms : number ) => new Promise ( resolve => setTimeout ( resolve , ms ) ) ;
49
-
50
- await sendNotification ( {
51
- method : "notifications/message" ,
52
- params : { level : "debug" , data : `Starting multi-greet for ${ name } ` }
53
- } ) ;
54
-
55
- await sleep ( 1000 ) ; // Wait 1 second before first greeting
56
-
57
- await sendNotification ( {
58
- method : "notifications/message" ,
59
- params : { level : "info" , data : `Sending first greeting to ${ name } ` }
60
- } ) ;
61
-
62
- await sleep ( 1000 ) ; // Wait another second before second greeting
63
-
64
- await sendNotification ( {
65
- method : "notifications/message" ,
66
- params : { level : "info" , data : `Sending second greeting to ${ name } ` }
67
- } ) ;
68
-
69
- return {
70
- content : [
71
- {
72
- type : 'text' ,
73
- text : `Good morning, ${ name } !` ,
74
- }
75
- ] ,
76
- } ;
77
- }
78
- ) ;
79
-
80
- // Register a simple prompt
81
- server . prompt (
82
- 'greeting-template' ,
83
- 'A simple greeting prompt template' ,
84
- {
85
- name : z . string ( ) . describe ( 'Name to include in greeting' ) ,
86
- } ,
87
- async ( { name } ) : Promise < GetPromptResult > => {
88
- return {
89
- messages : [
90
- {
91
- role : 'user' ,
92
- content : {
16
+ // Register a simple tool that returns a greeting
17
+ server . tool (
18
+ 'greet' ,
19
+ 'A simple greeting tool' ,
20
+ {
21
+ name : z . string ( ) . describe ( 'Name to greet' ) ,
22
+ } ,
23
+ async ( { name } ) : Promise < CallToolResult > => {
24
+ return {
25
+ content : [
26
+ {
93
27
type : 'text' ,
94
28
text : `Hello, ${ name } !` ,
95
29
} ,
@@ -98,13 +32,18 @@ server.prompt(
98
32
}
99
33
) ;
100
34
101
- // Register a tool that sends multiple greetings with notifications
35
+ // Register a tool that sends multiple greetings with notifications (with annotations)
102
36
server . tool (
103
37
'multi-greet' ,
104
38
'A tool that sends different greetings with delays between them' ,
105
39
{
106
40
name : z . string ( ) . describe ( 'Name to greet' ) ,
107
41
} ,
42
+ {
43
+ title : 'Multiple Greeting Tool' ,
44
+ readOnlyHint : true ,
45
+ openWorldHint : false
46
+ } ,
108
47
async ( { name } , { sendNotification } ) : Promise < CallToolResult > => {
109
48
const sleep = ( ms : number ) => new Promise ( resolve => setTimeout ( resolve , ms ) ) ;
110
49
0 commit comments