Merge pull request #81 from jonathanhefner/examples-use-content-for-now
Use `content` instead of `structuredContent` in examples
This commit is contained in:
commit
437b9185cc
2 changed files with 65 additions and 150 deletions
|
|
@ -121,7 +121,6 @@ const server = new McpServer({
|
|||
description:
|
||||
"Returns current system statistics including per-core CPU usage, memory, and system info.",
|
||||
inputSchema: {},
|
||||
outputSchema: SystemStatsSchema.shape,
|
||||
_meta: { [RESOURCE_URI_META_KEY]: resourceUri },
|
||||
},
|
||||
async (): Promise<CallToolResult> => {
|
||||
|
|
@ -148,8 +147,7 @@ const server = new McpServer({
|
|||
};
|
||||
|
||||
return {
|
||||
content: [{ type: "text", text: JSON.stringify(stats, null, 2) }],
|
||||
structuredContent: stats,
|
||||
content: [{ type: "text", text: JSON.stringify(stats) }],
|
||||
};
|
||||
},
|
||||
);
|
||||
|
|
|
|||
|
|
@ -264,7 +264,13 @@ async function fetchStats(): Promise<void> {
|
|||
arguments: {},
|
||||
});
|
||||
|
||||
const stats = result.structuredContent as unknown as SystemStats;
|
||||
const text = result
|
||||
.content!.filter(
|
||||
(c): c is { type: "text"; text: string } => c.type === "text",
|
||||
)
|
||||
.map((c) => c.text)
|
||||
.join("");
|
||||
const stats = JSON.parse(text) as SystemStats;
|
||||
|
||||
// Initialize chart on first data if needed
|
||||
if (!state.chart && stats.cpu.count > 0) {
|
||||
|
|
|
|||
Loading…
Reference in a new issue