Created
June 20, 2025 22:52
-
-
Save zackify/3121f7fdfb98a60442189e8f2aa9f6ca to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Async tool with external API call | |
| server.registerTool( | |
| "fetch-weather", | |
| { | |
| title: "Weather Fetcher", | |
| description: "Get weather data for a city", | |
| }, | |
| async () => { | |
| const result = await server.server.elicitInput({ | |
| message: `No tables available. Would you like to check alternative dates?`, | |
| requestedSchema: { | |
| type: "object", | |
| properties: { | |
| checkAlternatives: { | |
| type: "boolean", | |
| title: "Check alternative dates", | |
| description: "Would you like me to check other dates?", | |
| }, | |
| flexibleDates: { | |
| type: "string", | |
| title: "Date flexibility", | |
| description: "How flexible are your dates?", | |
| enum: ["next_day", "same_week", "next_week"], | |
| enumNames: ["Next day", "Same week", "Next week"], | |
| }, | |
| }, | |
| required: ["checkAlternatives"], | |
| }, | |
| }); | |
| return { | |
| content: [ | |
| { | |
| type: "text", | |
| text: result.content?.checkAlternatives | |
| ? "will check alternatives" | |
| : "will not check alternatives", | |
| }, | |
| ], | |
| }; | |
| } | |
| ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment