@noelclaw/mcp 1.5.0 → 1.5.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/tools/market.js +11 -0
- package/dist/tools/swarm.js +19 -1
- package/package.json +1 -1
package/dist/tools/market.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.MARKET_TOOLS = void 0;
|
|
4
|
+
exports.fetchMarketSnapshot = fetchMarketSnapshot;
|
|
4
5
|
exports.handleMarketTool = handleMarketTool;
|
|
5
6
|
const zod_1 = require("zod");
|
|
6
7
|
const COINGECKO = "https://api.coingecko.com/api/v3";
|
|
@@ -65,6 +66,16 @@ exports.MARKET_TOOLS = [
|
|
|
65
66
|
];
|
|
66
67
|
const GetMarketDataSchema = zod_1.z.object({ token: zod_1.z.string().optional() });
|
|
67
68
|
const GetTokenDataSchema = zod_1.z.object({ question: zod_1.z.string().min(1) });
|
|
69
|
+
async function fetchMarketSnapshot() {
|
|
70
|
+
try {
|
|
71
|
+
const data = await cgFetch("/coins/markets?vs_currency=usd&ids=bitcoin,ethereum,solana&sparkline=false&price_change_percentage=24h");
|
|
72
|
+
const find = (id) => data.find((c) => c.id === id)?.current_price ?? null;
|
|
73
|
+
return { btc: find("bitcoin"), eth: find("ethereum"), sol: find("solana") };
|
|
74
|
+
}
|
|
75
|
+
catch {
|
|
76
|
+
return null;
|
|
77
|
+
}
|
|
78
|
+
}
|
|
68
79
|
async function handleMarketTool(name, args) {
|
|
69
80
|
switch (name) {
|
|
70
81
|
case "get_market_data": {
|
package/dist/tools/swarm.js
CHANGED
|
@@ -4,6 +4,7 @@ exports.SWARM_TOOLS = void 0;
|
|
|
4
4
|
exports.handleSwarmTool = handleSwarmTool;
|
|
5
5
|
const zod_1 = require("zod");
|
|
6
6
|
const convex_js_1 = require("../convex.js");
|
|
7
|
+
const market_js_1 = require("./market.js");
|
|
7
8
|
exports.SWARM_TOOLS = [
|
|
8
9
|
{
|
|
9
10
|
name: "start_swarm",
|
|
@@ -79,10 +80,27 @@ async function handleSwarmTool(name, args) {
|
|
|
79
80
|
const data = await (0, convex_js_1.callConvex)("/swarm/start", "POST", { config: parsed.data.config }, "start_swarm");
|
|
80
81
|
if (!data.success)
|
|
81
82
|
return { content: [{ type: "text", text: `Failed: ${data.error}` }], isError: true };
|
|
83
|
+
const snapshot = await (0, market_js_1.fetchMarketSnapshot)();
|
|
84
|
+
if (snapshot) {
|
|
85
|
+
const ts = new Date().toUTCString();
|
|
86
|
+
const fmt = (n) => `$${n.toLocaleString("en-US", { minimumFractionDigits: 2, maximumFractionDigits: 2 })} (${ts})`;
|
|
87
|
+
await Promise.all([
|
|
88
|
+
(0, convex_js_1.callConvex)("/swarm/memory/write", "POST", { agentId: "market-monitor", key: "BTC/USD", value: fmt(snapshot.btc) }, "write_swarm_memory"),
|
|
89
|
+
(0, convex_js_1.callConvex)("/swarm/memory/write", "POST", { agentId: "market-monitor", key: "ETH/USD", value: fmt(snapshot.eth) }, "write_swarm_memory"),
|
|
90
|
+
(0, convex_js_1.callConvex)("/swarm/memory/write", "POST", { agentId: "market-monitor", key: "SOL/USD", value: fmt(snapshot.sol) }, "write_swarm_memory"),
|
|
91
|
+
]);
|
|
92
|
+
}
|
|
82
93
|
return {
|
|
83
94
|
content: [{
|
|
84
95
|
type: "text",
|
|
85
|
-
text: [
|
|
96
|
+
text: [
|
|
97
|
+
`🤖 **Swarm Started**`,
|
|
98
|
+
`Session ID: ${data.sessionId}`,
|
|
99
|
+
`Started at: ${data.startedAt}`,
|
|
100
|
+
snapshot ? `Market: BTC $${snapshot.btc.toLocaleString("en-US", { minimumFractionDigits: 2, maximumFractionDigits: 2 })} | ETH $${snapshot.eth.toLocaleString("en-US", { minimumFractionDigits: 2, maximumFractionDigits: 2 })} | SOL $${snapshot.sol.toLocaleString("en-US", { minimumFractionDigits: 2, maximumFractionDigits: 2 })}` : "",
|
|
101
|
+
``,
|
|
102
|
+
`Use \`get_swarm_status\` to monitor, \`stop_swarm\` to stop.`,
|
|
103
|
+
].filter(Boolean).join("\n"),
|
|
86
104
|
}],
|
|
87
105
|
};
|
|
88
106
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@noelclaw/mcp",
|
|
3
|
-
"version": "1.5.
|
|
3
|
+
"version": "1.5.1",
|
|
4
4
|
"description": "Noelclaw as an MCP skill — persistent memory, multi-agent coordination, scenario simulation, DeFi execution, and Sentinel-gated playbooks.",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"bin": {
|