Skip to content

Commit c628eaa

Browse files
autogame-17claude
andauthored
feat(mcp): add evolver_report_reuse tool + fetch reuse nudge (#4)
Agents fetch assets via evolver_fetch_asset but have had no way to report which ones they actually reused, so the reuse-reward attribution loop never closes for MCP clients -- the network sees the fetch but never the "I built on this" signal. Add evolver_report_reuse: the agent declares the asset_ids it genuinely reused; the bridge forwards them to the Proxy (POST /asset/report-reuse), which records the reuse against the author on the hub. Nudge it from evolver_fetch_asset's description and an additive _reuse_hint on the fetch result (does not alter the returned assets). Declaration model -- the hub verifies the claim against the node's own prior fetches. Requires the @evomap/evolver Proxy with the /asset/report-reuse route; on older Proxy builds the tool degrades gracefully (route returns an error, nothing breaks). Bridge version 0.1.0 -> 0.2.0. Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
1 parent 66a53b5 commit c628eaa

1 file changed

Lines changed: 25 additions & 3 deletions

File tree

mcp/evolver-proxy.mjs

Lines changed: 25 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ import { homedir } from 'node:os';
1919
import { join } from 'node:path';
2020
import { createInterface } from 'node:readline';
2121

22-
const SERVER = { name: 'evolver-proxy', version: '0.1.0' };
22+
const SERVER = { name: 'evolver-proxy', version: '0.2.0' };
2323
const DEFAULT_PROTOCOL = '2025-06-18';
2424

2525
function log(...a) { process.stderr.write('[evolver-proxy-mcp] ' + a.join(' ') + '\n'); }
@@ -107,14 +107,36 @@ const TOOLS = [
107107
},
108108
{
109109
name: 'evolver_fetch_asset',
110-
description: 'Fetch the full content of one or more evolution assets by their IDs (e.g. "sha256:abc..."), as returned by evolver_search_assets.',
110+
description: 'Fetch the full content of one or more evolution assets by their IDs (e.g. "sha256:abc..."), as returned by evolver_search_assets. After you actually reuse any of these in your work, call evolver_report_reuse with their IDs so the original author gets credit.',
111111
inputSchema: {
112112
type: 'object',
113113
properties: { asset_ids: { type: 'array', items: { type: 'string' }, minItems: 1 } },
114114
required: ['asset_ids'],
115115
additionalProperties: false,
116116
},
117-
handler: (a) => proxyFetch('POST', '/asset/fetch', { asset_ids: a.asset_ids }),
117+
handler: async (a) => {
118+
const res = await proxyFetch('POST', '/asset/fetch', { asset_ids: a.asset_ids });
119+
// Close the reuse-reward loop: nudge the agent, in-context, to report
120+
// what it reuses. Additive top-level field -- does not alter results.
121+
return (res && typeof res === 'object' && !Array.isArray(res))
122+
? { ...res, _reuse_hint: 'If you build on any of these assets, call evolver_report_reuse with the asset_ids you reused so the author gets credit.' }
123+
: res;
124+
},
125+
},
126+
{
127+
name: 'evolver_report_reuse',
128+
description: 'Report that you actually REUSED one or more fetched Gene/Capsule assets in your work (not just viewed them). This credits the original authors and feeds the reuse-reward network. Call it after you build on an asset fetched via evolver_fetch_asset; pass the asset_ids you genuinely reused.',
129+
inputSchema: {
130+
type: 'object',
131+
properties: {
132+
asset_ids: { type: 'array', items: { type: 'string' }, minItems: 1, description: 'The asset IDs you reused (as returned by evolver_fetch_asset).' },
133+
outcome: { type: 'string', enum: ['success', 'failed'], description: 'Whether reusing them worked out. Defaults to success.' },
134+
signals: { type: 'array', items: { type: 'string' }, description: 'Optional signal keywords describing the task you reused them on.' },
135+
},
136+
required: ['asset_ids'],
137+
additionalProperties: false,
138+
},
139+
handler: (a) => proxyFetch('POST', '/asset/report-reuse', { used_asset_ids: a.asset_ids, status: a.outcome || 'success', signals: a.signals }),
118140
},
119141
{
120142
name: 'evolver_publish_asset',

0 commit comments

Comments
 (0)