Skip to content

Commit 9fd4c9d

Browse files
authored
Merge pull request modelcontextprotocol#51 from pcarion/fix-typescript-mcp-server-weather
update tool response in typescript weather sample to be compliant with spec
2 parents 7f8c608 + 164d276 commit 9fd4c9d

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

docs/first-server/typescript.mdx

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -346,18 +346,18 @@ This guide uses the OpenWeatherMap API. You'll need a free API key from [OpenWea
346346
}
347347

348348
return {
349-
content: {
350-
mimeType: "application/json",
349+
content: [{
350+
type: "text",
351351
text: JSON.stringify(forecasts, null, 2)
352-
}
352+
}]
353353
};
354354
} catch (error) {
355355
if (axios.isAxiosError(error)) {
356356
return {
357-
content: {
358-
mimeType: "text/plain",
357+
content: [{
358+
type: "text",
359359
text: `Weather API error: ${error.response?.data.message ?? error.message}`
360-
},
360+
}],
361361
isError: true,
362362
}
363363
}

0 commit comments

Comments
 (0)