tokens-for-good 0.2.4 → 0.2.6
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/package.json
CHANGED
|
@@ -146,7 +146,7 @@ Inline citations as `[Source Name](URL)`. Distinguish attribution: "X reports th
|
|
|
146
146
|
|
|
147
147
|
### 3. Submit the Report
|
|
148
148
|
|
|
149
|
-
Submit using the `submit_report` tool with the full markdown as `report_markdown`.
|
|
149
|
+
Submit using the `submit_report` tool with the full markdown as `report_markdown`. Include `estimated_tokens`: count your web searches (~1K each), web fetches (~2-5K each), your report output (~4 tokens per word), plus ~10K for system/tool overhead.
|
|
150
150
|
|
|
151
151
|
## Quality Checks
|
|
152
152
|
- [ ] All 5 prompt tables present and complete (20 rows each)
|
package/src/mcp-server.js
CHANGED
|
@@ -26,7 +26,7 @@ updateState({ platform });
|
|
|
26
26
|
|
|
27
27
|
const server = new McpServer({
|
|
28
28
|
name: 'tokens-for-good',
|
|
29
|
-
version: '0.2.
|
|
29
|
+
version: '0.2.6',
|
|
30
30
|
});
|
|
31
31
|
|
|
32
32
|
// --- No-key onboarding message ---
|
|
@@ -191,15 +191,17 @@ server.tool('get_methodology', 'Get the full research methodology, verification
|
|
|
191
191
|
}
|
|
192
192
|
});
|
|
193
193
|
|
|
194
|
-
server.tool('submit_report', 'Submit a completed research report for an org you claimed.', {
|
|
194
|
+
server.tool('submit_report', 'Submit a completed research report for an org you claimed. You MUST include estimated_tokens — count your web searches (each ~1K tokens), web fetches (each ~2-5K tokens), and your output (~4 tokens per word of report). Add it all up.', {
|
|
195
195
|
claim_id: z.number().describe('The claim ID from claim_org'),
|
|
196
196
|
report_markdown: z.string().describe('The full research report in markdown'),
|
|
197
197
|
model_used: z.string().optional().describe('The model that generated this report'),
|
|
198
|
-
|
|
198
|
+
estimated_tokens: z.number().describe('Estimated total tokens: count web searches (~1K each), web fetches (~2-5K each), your report output (~4 tokens/word), plus ~10K for system prompts and tool calls'),
|
|
199
|
+
}, async ({ claim_id, report_markdown, model_used, estimated_tokens }) => {
|
|
199
200
|
if (!client) return { content: [{ type: 'text', text: 'Error: TFG_API_KEY not set.' }] };
|
|
200
201
|
|
|
202
|
+
const tokenUsage = estimated_tokens ? { total_tokens: estimated_tokens } : null;
|
|
201
203
|
try {
|
|
202
|
-
const result = await client.submitReport(claim_id, report_markdown,
|
|
204
|
+
const result = await client.submitReport(claim_id, report_markdown, tokenUsage, null, model_used);
|
|
203
205
|
markContributed();
|
|
204
206
|
const state = loadState();
|
|
205
207
|
const stats = result.contributor_stats;
|
|
@@ -277,10 +279,10 @@ server.tool('my_impact', 'See your personal contribution stats, tier, and histor
|
|
|
277
279
|
try {
|
|
278
280
|
const result = await client.getImpact();
|
|
279
281
|
const c = result.contributor;
|
|
280
|
-
const
|
|
282
|
+
const tokenStr = c.total_tokens > 0 ? `${(c.total_tokens / 1000).toFixed(0)}K tokens contributed` : 'No token data yet';
|
|
281
283
|
|
|
282
284
|
return {
|
|
283
|
-
content: [{ type: 'text', text: `Your Impact (@${c.github_handle}):\n\nTier: ${c.tier}\nOrgs researched: ${c.total_orgs}\
|
|
285
|
+
content: [{ type: 'text', text: `Your Impact (@${c.github_handle}):\n\nTier: ${c.tier}\nOrgs researched: ${c.total_orgs}\nTokens: ${tokenStr}\nAcceptance rate: ${c.acceptance_rate}%\nAutomation: ${c.has_schedule ? 'Active' : 'Not set up'}\n\nRecent:\n${result.claims?.slice(0, 5).map(cl => ` ${cl.organization?.name || 'Unknown'} - ${cl.status}`).join('\n') || 'None'}` }],
|
|
284
286
|
};
|
|
285
287
|
} catch (err) {
|
|
286
288
|
return { content: [{ type: 'text', text: `Error: ${err.message}` }] };
|