nodebench-mcp 1.4.0 → 2.0.0

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.
Files changed (38) hide show
  1. package/NODEBENCH_AGENTS.md +154 -2
  2. package/README.md +152 -192
  3. package/dist/__tests__/comparativeBench.test.d.ts +1 -0
  4. package/dist/__tests__/comparativeBench.test.js +722 -0
  5. package/dist/__tests__/comparativeBench.test.js.map +1 -0
  6. package/dist/__tests__/evalHarness.test.js +24 -2
  7. package/dist/__tests__/evalHarness.test.js.map +1 -1
  8. package/dist/__tests__/gaiaCapabilityEval.test.d.ts +14 -0
  9. package/dist/__tests__/gaiaCapabilityEval.test.js +420 -0
  10. package/dist/__tests__/gaiaCapabilityEval.test.js.map +1 -0
  11. package/dist/__tests__/gaiaCapabilityFilesEval.test.d.ts +15 -0
  12. package/dist/__tests__/gaiaCapabilityFilesEval.test.js +303 -0
  13. package/dist/__tests__/gaiaCapabilityFilesEval.test.js.map +1 -0
  14. package/dist/__tests__/openDatasetParallelEvalGaia.test.d.ts +7 -0
  15. package/dist/__tests__/openDatasetParallelEvalGaia.test.js +279 -0
  16. package/dist/__tests__/openDatasetParallelEvalGaia.test.js.map +1 -0
  17. package/dist/__tests__/openDatasetPerfComparison.test.d.ts +10 -0
  18. package/dist/__tests__/openDatasetPerfComparison.test.js +318 -0
  19. package/dist/__tests__/openDatasetPerfComparison.test.js.map +1 -0
  20. package/dist/__tests__/tools.test.js +155 -7
  21. package/dist/__tests__/tools.test.js.map +1 -1
  22. package/dist/db.js +56 -0
  23. package/dist/db.js.map +1 -1
  24. package/dist/index.js +370 -11
  25. package/dist/index.js.map +1 -1
  26. package/dist/tools/localFileTools.d.ts +15 -0
  27. package/dist/tools/localFileTools.js +386 -0
  28. package/dist/tools/localFileTools.js.map +1 -0
  29. package/dist/tools/metaTools.js +170 -3
  30. package/dist/tools/metaTools.js.map +1 -1
  31. package/dist/tools/parallelAgentTools.d.ts +18 -0
  32. package/dist/tools/parallelAgentTools.js +1272 -0
  33. package/dist/tools/parallelAgentTools.js.map +1 -0
  34. package/dist/tools/selfEvalTools.js +240 -10
  35. package/dist/tools/selfEvalTools.js.map +1 -1
  36. package/dist/tools/webTools.js +171 -37
  37. package/dist/tools/webTools.js.map +1 -1
  38. package/package.json +19 -7
package/dist/index.js CHANGED
@@ -19,7 +19,7 @@
19
19
  import { Server } from "@modelcontextprotocol/sdk/server/index.js";
20
20
  import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
21
21
  import { ListToolsRequestSchema, CallToolRequestSchema, ListPromptsRequestSchema, GetPromptRequestSchema, } from "@modelcontextprotocol/sdk/types.js";
22
- import { getDb } from "./db.js";
22
+ import { getDb, genId } from "./db.js";
23
23
  import { verificationTools } from "./tools/verificationTools.js";
24
24
  import { evalTools } from "./tools/evalTools.js";
25
25
  import { qualityGateTools } from "./tools/qualityGateTools.js";
@@ -33,7 +33,9 @@ import { githubTools } from "./tools/githubTools.js";
33
33
  import { documentationTools } from "./tools/documentationTools.js";
34
34
  import { agentBootstrapTools } from "./tools/agentBootstrapTools.js";
35
35
  import { selfEvalTools } from "./tools/selfEvalTools.js";
36
+ import { parallelAgentTools } from "./tools/parallelAgentTools.js";
36
37
  import { createMetaTools } from "./tools/metaTools.js";
38
+ import { localFileTools } from "./tools/localFileTools.js";
37
39
  // Initialize DB (creates ~/.nodebench/ and schema on first run)
38
40
  getDb();
39
41
  // Assemble tools
@@ -46,11 +48,13 @@ const domainTools = [
46
48
  ...reconTools,
47
49
  ...uiCaptureTools,
48
50
  ...visionTools,
51
+ ...localFileTools,
49
52
  ...webTools,
50
53
  ...githubTools,
51
54
  ...documentationTools,
52
55
  ...agentBootstrapTools,
53
56
  ...selfEvalTools,
57
+ ...parallelAgentTools,
54
58
  ];
55
59
  const allTools = [...domainTools, ...createMetaTools(domainTools)];
56
60
  // Build a lookup map for fast tool dispatch
@@ -58,6 +62,10 @@ const toolMap = new Map();
58
62
  for (const tool of allTools) {
59
63
  toolMap.set(tool.name, tool);
60
64
  }
65
+ // Auto-instrumentation: generate a session ID per MCP connection
66
+ const SESSION_ID = genId("mcp");
67
+ // Tools to skip auto-logging (avoid infinite recursion and noise)
68
+ const SKIP_AUTO_LOG = new Set(["log_tool_call", "get_trajectory_analysis", "get_self_eval_report", "get_improvement_recommendations", "cleanup_stale_runs", "synthesize_recon_to_learnings"]);
61
69
  // MCP Prompts — protocol-native agent instructions for onboarding
62
70
  const PROMPTS = [
63
71
  {
@@ -68,7 +76,17 @@ const PROMPTS = [
68
76
  role: "user",
69
77
  content: {
70
78
  type: "text",
71
- text: `You are connected to NodeBench Development Methodology MCP — a tool suite for rigorous software development.
79
+ text: `You are connected to NodeBench MCP — tools that make you catch the bugs you'd normally ship.
80
+
81
+ WHAT THIS DOES:
82
+ In benchmarks across 9 real production prompts, agents with NodeBench MCP caught 13 issues (4 HIGH severity)
83
+ that bare agents shipped to production. 26 blind spots prevented. Knowledge compounds — by task 9,
84
+ the agent finds 2+ prior findings before writing a single line of code.
85
+
86
+ HOW IT WORKS:
87
+ Every task follows a pipeline: Research → Risk → Implement → Test (3 layers) → Eval → Gate → Learn → Ship.
88
+ Each step produces a concrete artifact (an issue found, a regression guarded, a pattern banked) that
89
+ compounds into future tasks.
72
90
 
73
91
  FIRST TIME? Run these 3 steps:
74
92
  1. Call bootstrap_project to register your project (tech stack, architecture, conventions)
@@ -76,18 +94,20 @@ FIRST TIME? Run these 3 steps:
76
94
  3. Call search_all_knowledge("your current task") before starting any work
77
95
 
78
96
  RETURNING? Your project context and all past learnings are persisted. Start with:
79
- 1. Call get_project_context to refresh your project awareness
80
- 2. Call search_all_knowledge with your current task
81
- 3. Follow the methodology tools as you work — they'll guide you step by step
97
+ 1. Call search_all_knowledge with your current task
98
+ 2. Follow the methodology tools as you work — they'll guide you step by step
82
99
 
83
100
  KEY TOOLS:
101
+ - search_all_knowledge — Search prior findings before starting (avoid repeating past mistakes)
102
+ - run_mandatory_flywheel — 6-step minimum verification before declaring work done
84
103
  - getMethodology — Step-by-step guides for verification, eval, flywheel, recon
85
104
  - findTools — Discover tools by keyword or category
86
- - search_all_knowledgeSearch learnings + recon findings + resolved gaps
87
- - bootstrap_project — Register/update project context
88
- - run_mandatory_flywheel — Required 6-step verification for any non-trivial change
105
+ - assess_riskAssess risk before acting (HIGH = needs confirmation)
89
106
 
90
- The knowledge base grows automatically as you work. Every verification cycle, eval run, and resolved gap contributes back.`,
107
+ PARALLEL AGENTS? If using Claude Code subagents or multiple terminals:
108
+ - claim_agent_task / release_agent_task — Lock tasks to prevent duplicate work
109
+ - get_parallel_status — See what all agents are doing
110
+ - Use the "claude-code-parallel" prompt for step-by-step guidance`,
91
111
  },
92
112
  },
93
113
  ],
@@ -169,6 +189,319 @@ Commands available:
169
189
  },
170
190
  ],
171
191
  },
192
+ {
193
+ name: "parallel-agent-team",
194
+ description: "Set up and coordinate a parallel agent team. Based on Anthropic's 'Building a C Compiler with Parallel Claudes' (Feb 2026). Guides multi-agent orchestration with task locking, role assignment, and progress tracking.",
195
+ arguments: [
196
+ {
197
+ name: "projectGoal",
198
+ description: "The overall project goal the team is working toward (e.g. 'Build REST API', 'Migrate auth system')",
199
+ required: true,
200
+ },
201
+ {
202
+ name: "agentCount",
203
+ description: "Number of parallel agents (default: 4)",
204
+ required: false,
205
+ },
206
+ ],
207
+ messages: (args) => {
208
+ const agentCount = parseInt(args.agentCount || "4", 10);
209
+ return [
210
+ {
211
+ role: "user",
212
+ content: {
213
+ type: "text",
214
+ text: `You are coordinating a parallel agent team for: ${args.projectGoal}
215
+
216
+ This follows the pattern from Anthropic's "Building a C Compiler with Parallel Claudes" (Feb 2026).
217
+ Reference: https://www.anthropic.com/engineering/building-c-compiler
218
+
219
+ SETUP (run these in order):
220
+
221
+ 1. ORIENT — Check what's already happening:
222
+ call get_parallel_status({ includeHistory: true })
223
+ call list_agent_tasks({ status: "all" })
224
+
225
+ 2. PLAN ROLES — Assign ${agentCount} specialized agents:
226
+ Recommended role split for ${agentCount} agents:
227
+ ${agentCount >= 4 ? `- Agent 1: assign_agent_role({ role: "implementer", focusArea: "core features" })
228
+ - Agent 2: assign_agent_role({ role: "test_writer", focusArea: "test coverage" })
229
+ - Agent 3: assign_agent_role({ role: "code_quality_critic", focusArea: "refactoring" })
230
+ - Agent 4: assign_agent_role({ role: "documentation_maintainer", focusArea: "docs and progress" })` :
231
+ `- Agent 1: assign_agent_role({ role: "implementer" })
232
+ - Agent 2: assign_agent_role({ role: "test_writer" })`}
233
+
234
+ 3. BREAK DOWN WORK — Create task claims:
235
+ For each independent piece of work:
236
+ call claim_agent_task({ taskKey: "descriptive_snake_case", description: "What to do" })
237
+
238
+ 4. WORK LOOP (each agent independently):
239
+ a. claim_agent_task — Lock your task
240
+ b. Do the work (implement, test, review)
241
+ c. log_context_budget — Track context usage, avoid pollution
242
+ d. run_oracle_comparison — Validate output against known-good reference
243
+ e. release_agent_task — Release with progress note
244
+ f. Pick next task (repeat)
245
+
246
+ 5. ANTI-PATTERNS TO AVOID:
247
+ - Two agents working on the same task (always claim first)
248
+ - Dumping thousands of lines of test output (log to file, print summary)
249
+ - Spending hours on one stuck problem (mark as blocked, move on)
250
+ - Overwriting each other's changes (commit frequently, pull before push)
251
+
252
+ KEY INSIGHT from Anthropic: When all agents get stuck on the same bug (like compiling the Linux kernel),
253
+ use oracle-based testing to split the problem into independent sub-problems that each agent can solve in parallel.
254
+
255
+ For the full methodology: call getMethodology("parallel_agent_teams")`,
256
+ },
257
+ },
258
+ ];
259
+ },
260
+ },
261
+ {
262
+ name: "oracle-test-harness",
263
+ description: "Set up oracle-based testing for a component. Compares your implementation's output against a known-good reference to identify exactly which parts are broken. Enables parallel debugging by splitting failures into independent work items.",
264
+ arguments: [
265
+ {
266
+ name: "componentName",
267
+ description: "The component to validate (e.g. 'API response formatter', 'auth middleware', 'data pipeline')",
268
+ required: true,
269
+ },
270
+ {
271
+ name: "oracleSource",
272
+ description: "Where the known-good reference comes from (e.g. 'production_v2', 'reference_impl', 'golden_files')",
273
+ required: true,
274
+ },
275
+ ],
276
+ messages: (args) => [
277
+ {
278
+ role: "user",
279
+ content: {
280
+ type: "text",
281
+ text: `Set up oracle-based testing for: ${args.componentName}
282
+ Oracle source: ${args.oracleSource}
283
+
284
+ This follows the pattern from Anthropic's C Compiler project where GCC served as a
285
+ "known-good compiler oracle" to identify which specific files were broken.
286
+
287
+ SETUP:
288
+
289
+ 1. DEFINE ORACLE — Capture known-good reference outputs:
290
+ Run the reference implementation (${args.oracleSource}) on each test input.
291
+ Save outputs as golden files or capture them in the oracle comparison tool.
292
+
293
+ 2. RUN COMPARISONS — For each test case:
294
+ call run_oracle_comparison({
295
+ testLabel: "${args.componentName}_test_1",
296
+ actualOutput: "<your implementation's output>",
297
+ expectedOutput: "<oracle's output>",
298
+ oracleSource: "${args.oracleSource}"
299
+ })
300
+
301
+ 3. TRIAGE FAILURES — Review diff summaries:
302
+ Each failing comparison is an independent work item.
303
+ Assign each to a different parallel agent via claim_agent_task.
304
+
305
+ 4. BINARY SEARCH (for complex failures):
306
+ If a test passes individually but fails when combined with others,
307
+ use delta debugging: split the test set in half, test each half,
308
+ narrow down to the minimal failing combination.
309
+ (This is how Anthropic found pairs of files that failed together but worked independently.)
310
+
311
+ 5. TRACK PROGRESS — Monitor convergence:
312
+ call get_parallel_status to see how many oracle tests are still failing.
313
+ As agents fix failures, the match percentage should trend toward 100%.
314
+
315
+ CONTEXT BUDGET TIP: Large test outputs pollute context. Instead of printing full output,
316
+ call log_context_budget to track usage and only show diff summaries (first 20 differing lines).
317
+
318
+ After all oracle tests pass:
319
+ call record_learning with patterns discovered
320
+ call run_mandatory_flywheel to verify the full change`,
321
+ },
322
+ },
323
+ ],
324
+ },
325
+ {
326
+ name: "claude-code-parallel",
327
+ description: "Guide for using NodeBench MCP with Claude Code's native Task tool to run parallel subagents. Each subagent gets its own context window and can coordinate via shared NodeBench MCP tools (claim_agent_task, assign_agent_role, run_oracle_comparison). Use this when you want multiple Claude Code subagents working on independent tasks without duplicate effort.",
328
+ arguments: [
329
+ {
330
+ name: "taskDescription",
331
+ description: "The overall task to split across parallel subagents (e.g. 'Fix auth, add tests, update docs')",
332
+ required: true,
333
+ },
334
+ {
335
+ name: "subagentCount",
336
+ description: "Number of parallel subagents to coordinate (default: 3)",
337
+ required: false,
338
+ },
339
+ ],
340
+ messages: (args) => {
341
+ const count = parseInt(args.subagentCount || "3", 10);
342
+ return [
343
+ {
344
+ role: "user",
345
+ content: {
346
+ type: "text",
347
+ text: `You are coordinating ${count} parallel Claude Code subagents for: ${args.taskDescription}
348
+
349
+ ## How This Works
350
+
351
+ Claude Code's Task tool spawns subagents — each is an independent Claude instance with its own
352
+ context window. NodeBench MCP tools coordinate them via a shared SQLite database.
353
+
354
+ **Your role: COORDINATOR.** You break work into independent tasks and spawn subagents.
355
+ **Subagent role: WORKER.** Each claims a task, does work, releases with a progress note.
356
+
357
+ ## Step-by-Step
358
+
359
+ ### 1. PLAN — Break work into ${count} independent tasks
360
+ Identify ${count} pieces of work that can run in parallel without dependencies.
361
+ Each task should be independently completable and testable.
362
+
363
+ ### 2. SPAWN — Launch subagents with coordination instructions
364
+ For each task, use the Task tool:
365
+
366
+ \`\`\`
367
+ Task tool call:
368
+ prompt: "You have access to NodeBench MCP. Do the following:
369
+ 1. Call claim_agent_task({ taskKey: '<task_key>', description: '<what to do>' })
370
+ 2. Call assign_agent_role({ role: 'implementer', focusArea: '<area>' })
371
+ 3. Do the work
372
+ 4. Call log_context_budget({ eventType: 'checkpoint', tokensUsed: <estimate> })
373
+ 5. Call release_agent_task({ taskKey: '<task_key>', status: 'completed', progressNote: '<summary>' })
374
+ 6. Call record_learning({ key: '<key>', content: '<what you learned>', category: 'pattern' })"
375
+ \`\`\`
376
+
377
+ ### 3. MONITOR — Check progress
378
+ After spawning all subagents:
379
+ call get_parallel_status({ includeHistory: true })
380
+ call list_agent_tasks({ status: "all" })
381
+
382
+ ### 4. VALIDATE — Run oracle comparisons if applicable
383
+ If subagents produced outputs that should match a reference:
384
+ call run_oracle_comparison for each output
385
+
386
+ ### 5. GATE — Quality check the aggregate result
387
+ call run_quality_gate with rules covering all ${count} tasks
388
+ call run_mandatory_flywheel to verify the combined change
389
+
390
+ ## Concrete IMPACT of This Workflow
391
+
392
+ | What NodeBench Adds | Without It (bare subagents) |
393
+ |---------------------------------|---------------------------------------|
394
+ | Task locks prevent duplicate work | Two subagents might fix the same bug |
395
+ | Role specialization | All subagents do everything |
396
+ | Context budget tracking | Subagent runs out of context silently |
397
+ | Oracle comparisons | No reference-based validation |
398
+ | Progress notes for handoff | Next session starts from scratch |
399
+ | Learnings persisted | Knowledge lost when subagent exits |
400
+ | Quality gate on aggregate | No validation that pieces fit together |
401
+
402
+ ## Anti-Patterns
403
+ - DO NOT spawn subagents for work that has dependencies (sequential steps)
404
+ - DO NOT skip claim_agent_task — without it, two subagents may duplicate effort
405
+ - DO NOT dump large outputs into subagent context — use log_context_budget to track
406
+ - DO NOT forget release_agent_task — orphaned claims block future sessions
407
+
408
+ For the full parallel agent methodology: call getMethodology("parallel_agent_teams")`,
409
+ },
410
+ },
411
+ ];
412
+ },
413
+ },
414
+ {
415
+ name: "bootstrap-parallel-agents",
416
+ description: "Detect and scaffold parallel agent infrastructure for any project. Scans a target repo for 7 categories of parallel agent capabilities (task locking, roles, oracle testing, context budget, progress files, AGENTS.md, worktrees) and bootstraps what's missing. Uses the AI Flywheel closed loop: detect → scaffold → verify → fix → document.",
417
+ arguments: [
418
+ {
419
+ name: "projectPath",
420
+ description: "Absolute path to the target project root (e.g. '/home/user/their-project')",
421
+ required: true,
422
+ },
423
+ {
424
+ name: "techStack",
425
+ description: "Target project's tech stack (e.g. 'TypeScript/React', 'Python/Django', 'Rust')",
426
+ required: false,
427
+ },
428
+ ],
429
+ messages: (args) => [
430
+ {
431
+ role: "user",
432
+ content: {
433
+ type: "text",
434
+ text: `Bootstrap parallel agent infrastructure for: ${args.projectPath}
435
+ ${args.techStack ? `Tech stack: ${args.techStack}` : ""}
436
+
437
+ This follows the AI Flywheel closed loop: detect → scaffold → verify → fix → document.
438
+
439
+ STEP 1 — DETECT (dry run first):
440
+ call bootstrap_parallel_agents({
441
+ projectRoot: "${args.projectPath}",
442
+ dryRun: true,
443
+ ${args.techStack ? `techStack: "${args.techStack}",` : ""}
444
+ includeAgentsMd: true
445
+ })
446
+
447
+ Review the gap report. It scans 7 categories:
448
+ - Task coordination (lock files, claim directories)
449
+ - Role specialization (role configs, AGENTS.md mentions)
450
+ - Oracle testing (golden files, reference outputs, snapshots)
451
+ - Context budget tracking (budget configs, AGENTS.md mentions)
452
+ - Progress files (PROGRESS.md, STATUS.md, claude-progress.txt)
453
+ - AGENTS.md parallel section (parallel agent coordination protocol)
454
+ - Git worktrees (for true parallel work)
455
+
456
+ STEP 2 — SCAFFOLD (create files):
457
+ If gaps found, run with dryRun=false:
458
+ call bootstrap_parallel_agents({
459
+ projectRoot: "${args.projectPath}",
460
+ dryRun: false,
461
+ ${args.techStack ? `techStack: "${args.techStack}",` : ""}
462
+ includeAgentsMd: true
463
+ })
464
+
465
+ This creates:
466
+ - .parallel-agents/ directory with README, current_tasks/, oracle/, roles.json
467
+ - progress.md template for agent orientation
468
+ - AGENTS.md parallel section (or .parallel-append file for existing AGENTS.md)
469
+
470
+ STEP 3 — GENERATE AGENTS.MD (if needed):
471
+ call generate_parallel_agents_md({
472
+ ${args.techStack ? `techStack: "${args.techStack}",` : ""}
473
+ projectName: "${args.projectPath.split("/").pop() || "project"}",
474
+ maxAgents: 4,
475
+ includeNodebenchSetup: true
476
+ })
477
+
478
+ Copy the output into the target repo's AGENTS.md.
479
+
480
+ STEP 4 — VERIFY (6-step flywheel):
481
+ The bootstrap tool returns a flywheelPlan. Execute each step:
482
+ 1. Static analysis — verify scaffold files don't conflict
483
+ 2. Happy path — claim task → work → release → progress.md updated
484
+ 3. Conflict test — two claims on same task → second gets conflict
485
+ 4. Oracle test — create golden file → diff catches changes
486
+ 5. Gap re-scan — re-run bootstrap with dryRun=true → all gaps filled
487
+ 6. Document — record_learning with patterns discovered
488
+
489
+ STEP 5 — FIX (if anything fails):
490
+ Fix the issue, then re-run from Step 4.
491
+
492
+ STEP 6 — DOCUMENT:
493
+ call record_learning({
494
+ key: "bootstrap_parallel_${args.projectPath.split("/").pop() || "project"}",
495
+ content: "Bootstrapped parallel agent infrastructure for ${args.projectPath}. <summary of what was created and any issues found>",
496
+ category: "pattern",
497
+ tags: ["parallel-agents", "bootstrap", "external-repo"]
498
+ })
499
+
500
+ For the full methodology: call getMethodology("parallel_agent_teams")`,
501
+ },
502
+ },
503
+ ],
504
+ },
172
505
  ];
173
506
  const server = new Server({ name: "nodebench-mcp-methodology", version: "2.0.0" }, { capabilities: { tools: {}, prompts: {} } });
174
507
  // Handle tools/list — return all tools with their JSON Schema inputSchemas
@@ -181,7 +514,7 @@ server.setRequestHandler(ListToolsRequestSchema, async () => {
181
514
  })),
182
515
  };
183
516
  });
184
- // Handle tools/call — dispatch to the matching tool handler
517
+ // Handle tools/call — dispatch to the matching tool handler (auto-instrumented)
185
518
  server.setRequestHandler(CallToolRequestSchema, async (request) => {
186
519
  const { name, arguments: args } = request.params;
187
520
  const tool = toolMap.get(name);
@@ -191,8 +524,24 @@ server.setRequestHandler(CallToolRequestSchema, async (request) => {
191
524
  isError: true,
192
525
  };
193
526
  }
527
+ const startMs = Date.now();
528
+ let resultStatus = "success";
529
+ let errorMsg = null;
194
530
  try {
195
531
  const result = await tool.handler(args ?? {});
532
+ // Detect soft errors (tools that return { error: true } without throwing)
533
+ if (result && typeof result === "object" && !Array.isArray(result) && result.error) {
534
+ resultStatus = "error";
535
+ errorMsg = result.message ?? "soft error";
536
+ }
537
+ // Auto-log (skip self-eval tools to avoid recursion/noise)
538
+ if (!SKIP_AUTO_LOG.has(name)) {
539
+ try {
540
+ const db = getDb();
541
+ db.prepare("INSERT INTO tool_call_log (id, session_id, tool_name, result_status, duration_ms, error, created_at) VALUES (?, ?, ?, ?, ?, ?, datetime('now'))").run(genId("tcl"), SESSION_ID, name, resultStatus, Date.now() - startMs, errorMsg);
542
+ }
543
+ catch { /* never let instrumentation break tool dispatch */ }
544
+ }
196
545
  // Tools with rawContent return ContentBlock[] directly (e.g. image captures)
197
546
  if (tool.rawContent && Array.isArray(result)) {
198
547
  return { content: result, isError: false };
@@ -203,8 +552,18 @@ server.setRequestHandler(CallToolRequestSchema, async (request) => {
203
552
  };
204
553
  }
205
554
  catch (err) {
555
+ resultStatus = "error";
556
+ errorMsg = err?.message || "Internal error";
557
+ // Auto-log errors
558
+ if (!SKIP_AUTO_LOG.has(name)) {
559
+ try {
560
+ const db = getDb();
561
+ db.prepare("INSERT INTO tool_call_log (id, session_id, tool_name, result_status, duration_ms, error, created_at) VALUES (?, ?, ?, ?, ?, ?, datetime('now'))").run(genId("tcl"), SESSION_ID, name, resultStatus, Date.now() - startMs, errorMsg);
562
+ }
563
+ catch { /* never let instrumentation break tool dispatch */ }
564
+ }
206
565
  return {
207
- content: [{ type: "text", text: err?.message || "Internal error" }],
566
+ content: [{ type: "text", text: errorMsg }],
208
567
  isError: true,
209
568
  };
210
569
  }
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AACA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,2CAA2C,CAAC;AACnE,OAAO,EAAE,oBAAoB,EAAE,MAAM,2CAA2C,CAAC;AACjF,OAAO,EACL,sBAAsB,EACtB,qBAAqB,EACrB,wBAAwB,EACxB,sBAAsB,GACvB,MAAM,oCAAoC,CAAC;AAC5C,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAChC,OAAO,EAAE,iBAAiB,EAAE,MAAM,8BAA8B,CAAC;AACjE,OAAO,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AACjD,OAAO,EAAE,gBAAgB,EAAE,MAAM,6BAA6B,CAAC;AAC/D,OA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AS,CAAC,CAAC;AAEhC,OAAO,CAAC,KAAK,CAAC,oCAAoC,QAAQ,CAAC,MAAM,WAAW,OAAO,CAAC,MAAM,oCAAoC,CAAC,CAAC"}
@@ -0,0 +1,15 @@
1
+ /**
2
+ * Local file parsing tools (deterministic).
3
+ *
4
+ * These tools intentionally avoid network access and operate only on local files.
5
+ * Primary use cases:
6
+ * - GAIA file-backed tasks (PDF / XLSX / CSV attachments)
7
+ * - Internal agent workflows that need structured parsing without "LLM OCR"
8
+ *
9
+ * Optional deps (installed by default when available):
10
+ * - xlsx: XLSX parsing
11
+ * - papaparse: CSV parsing
12
+ * - pdf-parse: PDF text extraction (page-aware)
13
+ */
14
+ import type { McpTool } from "../types.js";
15
+ export declare const localFileTools: McpTool[];