Skip to main content
Glama
by microsoft
fallback-tools.genai.mjs1.42 kB
script({ tests: { keywords: "sunny", }, fallbackTools: true, }) defTool( "get_weather", "Get the real-time weather information at a given location or city", { type: "object", properties: { location: { type: "string", description: "The city and state, e.g. Chicago, IL", }, }, required: ["location"], }, ({ location }) => { return /paris/i.test(location) ? "sunny" : "unknown" } ) const res = await runPrompt( (_) => { _.defTool( "get_weather", "Get the real-time weather information at a given location or city", { type: "object", properties: { location: { type: "string", description: "The city and state, e.g. Chicago, IL", }, }, required: ["location"], }, ({ location }) => { return /brussels/i.test(location) ? "cloudy" : "unknown" } ) _.$`What is the current weather in Brussels?` }, { fallbackTools: true } ) if (res.error) throw new Error(res.error.message) if (!res.text.includes("cloudy")) throw new Error("Expected cloudy weather in Brussels") $`What is the current weather in Paris?`

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/microsoft/genaiscript'

If you have feedback or need assistance with the MCP directory API, please join our Discord server