Slide 19
Slide 19 text
利用用途
server.registerTool(
'weather-fetcher',
{
description: 'Fetches weather information from a public API.'
},
async () => {
const appId = "client-id"
const apiResponse = await fetch(
`https://map.yahooapis.jp/weather/V1/place?appid=${appId}&coordinates=139.6500,35.6764&output=json`,{
method: "GET",
}
);
const data = await apiResponse.json();
return {
content: [
{
type: 'text',
text: JSON.stringify(data),
},
],
};
},
);