@@ -16,13 +16,15 @@ export class TinyMcp extends McpAgent {
1616 server = new McpServer ({ name: " " , version: " v1.0.0" });
1717
1818 async init() {
19- this .server .tool (
19+ this .server .registerTool (
2020 " square" ,
21- " Squares a number" ,
22- { number: z .number () },
21+ {
22+ description: " Squares a number" ,
23+ inputSchema: { number: z .number () }
24+ },
2325 async ({ number }) => ({
2426 content: [{ type: " text" , text: String (number ** 2 ) }]
25- })
27+ }
2628 );
2729 }
2830}
@@ -91,12 +93,14 @@ export class StorageMcp extends McpAgent {
9193 content: [{ type: " text" as const , text }]
9294 });
9395
94- this .server .tool (
96+ this .server .registerTool (
9597 " writeFile" ,
96- " Store text as a file with the given path" ,
9798 {
98- path: z .string ().describe (" Absolute path of the file" ),
99- content: z .string ().describe (" The content to store" )
99+ description: " Store text as a file with the given path" ,
100+ inputSchema: {
101+ path: z .string ().describe (" Absolute path of the file" ),
102+ content: z .string ().describe (" The content to store" )
103+ }
100104 },
101105 async ({ path , content }) => {
102106 try {
@@ -108,11 +112,13 @@ export class StorageMcp extends McpAgent {
108112 }
109113 );
110114
111- this .server .tool (
115+ this .server .registerTool (
112116 " readFile" ,
113- " Read the contents of a file" ,
114117 {
115- path: z .string ().describe (" Absolute path of the file to read" )
118+ description: " Read the contents of a file" ,
119+ inputSchema: {
120+ path: z .string ().describe (" Absolute path of the file to read" )
121+ }
116122 },
117123 async ({ path }) => {
118124 const obj = await env .BUCKET .get (path );
@@ -126,9 +132,15 @@ export class StorageMcp extends McpAgent {
126132 }
127133 );
128134
129- this .server .tool (" whoami" , " Check who the user is" , async () => {
130- return textRes (` ${this .props ?.userId } ` );
131- });
135+ this .server .registerTool (
136+ " whoami" ,
137+ {
138+ description: " Check who the user is"
139+ },
140+ async () => {
141+ return textRes (` ${this .props ?.userId } ` );
142+ }
143+ );
132144 }
133145}
134146
0 commit comments