Merge pull request #51 from pcarion/fix-typescript-mcp-server-weather
update tool response in typescript weather sample to be compliant with spec
This commit is contained in:
commit
9fd4c9d2a1
1 changed files with 6 additions and 6 deletions
|
|
@ -346,18 +346,18 @@ This guide uses the OpenWeatherMap API. You'll need a free API key from [OpenWea
|
|||
}
|
||||
|
||||
return {
|
||||
content: {
|
||||
mimeType: "application/json",
|
||||
content: [{
|
||||
type: "text",
|
||||
text: JSON.stringify(forecasts, null, 2)
|
||||
}
|
||||
}]
|
||||
};
|
||||
} catch (error) {
|
||||
if (axios.isAxiosError(error)) {
|
||||
return {
|
||||
content: {
|
||||
mimeType: "text/plain",
|
||||
content: [{
|
||||
type: "text",
|
||||
text: `Weather API error: ${error.response?.data.message ?? error.message}`
|
||||
},
|
||||
}],
|
||||
isError: true,
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue