crafty_get_stats
Retrieve host system statistics from Crafty Controller, including CPU, RAM, disk usage, and boot time data for monitoring and analysis.
Instructions
Get Crafty Controller host system stats: CPU usage/count/frequency, RAM usage/total/percent, disk data (device, total, used, free, percent, filesystem, mount), and boot time
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/tools/crafty.ts:10-18 (handler)The handler function for 'crafty_get_stats', which makes an HTTP request to the Crafty Controller to fetch system statistics.
async () => { try { const data = await client.get("/crafty/stats"); return { content: [{ type: "text", text: JSON.stringify(data, null, 2) }] }; } catch (error) { const msg = error instanceof Error ? error.message : String(error); return { content: [{ type: "text", text: `Error: ${msg}` }], isError: true }; } } - src/tools/crafty.ts:6-19 (registration)Registration of the 'crafty_get_stats' tool within the MCP server using the 'server.tool' method.
server.tool( "crafty_get_stats", "Get Crafty Controller host system stats: CPU usage/count/frequency, RAM usage/total/percent, disk data (device, total, used, free, percent, filesystem, mount), and boot time", {}, async () => { try { const data = await client.get("/crafty/stats"); return { content: [{ type: "text", text: JSON.stringify(data, null, 2) }] }; } catch (error) { const msg = error instanceof Error ? error.message : String(error); return { content: [{ type: "text", text: `Error: ${msg}` }], isError: true }; } } );