docs(examples): add Bilig WorkPaper MCP example#1297
Conversation
|
|
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
📝 WalkthroughWalkthroughAdds a new example demonstrating VoltAgent control of a Bilig WorkPaper via MCP: project scaffolding, MCP config using ChangesBilig WorkPaper MCP Example
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
examples/with-bilig-workpaper-mcp/src/proof.ts (1)
101-113: 💤 Low valueRedundant validation after
findToolalready checks.The
findToolcall at line 106 already validates thattool.executeis a function (line 63). The check at lines 108-109 is redundant.♻️ Proposed simplification
async function callTool( tools: readonly ExecutableTool[], suffix: string, args: JsonRecord, ): Promise<JsonRecord> { const tool = findTool(tools, suffix); - const execute = tool.execute; - if (typeof execute !== "function") { - throw new Error(`Missing executable Bilig MCP tool: ${suffix}`); - } - - return structuredContent(await execute(args), suffix); + return structuredContent(await tool.execute(args), suffix); }🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@examples/with-bilig-workpaper-mcp/src/proof.ts` around lines 101 - 113, The check for execute being a function in callTool is redundant because findTool already ensures tool.execute is callable; remove the typeof execute !== "function" guard and its error throw, and simply invoke tool.execute(args) (or await tool.execute(args)) and pass the result to structuredContent; reference functions/classes: callTool, findTool, ExecutableTool, execute, and structuredContent.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Nitpick comments:
In `@examples/with-bilig-workpaper-mcp/src/proof.ts`:
- Around line 101-113: The check for execute being a function in callTool is
redundant because findTool already ensures tool.execute is callable; remove the
typeof execute !== "function" guard and its error throw, and simply invoke
tool.execute(args) (or await tool.execute(args)) and pass the result to
structuredContent; reference functions/classes: callTool, findTool,
ExecutableTool, execute, and structuredContent.
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: d069f606-18d1-4164-9153-22e3afa3d535
⛔ Files ignored due to path filters (1)
pnpm-lock.yamlis excluded by!**/pnpm-lock.yaml
📒 Files selected for processing (9)
examples/README.mdexamples/with-bilig-workpaper-mcp/.env.exampleexamples/with-bilig-workpaper-mcp/.gitignoreexamples/with-bilig-workpaper-mcp/README.mdexamples/with-bilig-workpaper-mcp/package.jsonexamples/with-bilig-workpaper-mcp/src/index.tsexamples/with-bilig-workpaper-mcp/src/mcp.tsexamples/with-bilig-workpaper-mcp/src/proof.tsexamples/with-bilig-workpaper-mcp/tsconfig.json
ae36c59 to
21f1c2f
Compare
21f1c2f to
a4267af
Compare
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@examples/with-bilig-workpaper-mcp/src/mcp.ts`:
- Line 4: Replace the floating tag "`@bilig/workpaper`@latest" with a concrete
published version in the 0.40.x series to ensure deterministic runs: update the
exported constant biligWorkPaperPackage (symbol: biligWorkPaperPackage) to use a
pinned version such as "`@bilig/workpaper`@0.40.0" (or another exact 0.40.x
release you verify exists), and make the same change to the README entry that
references "`@bilig/workpaper`@latest".
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: c0bd9359-2bf0-4b59-8d5c-3bfa6a815607
📒 Files selected for processing (2)
examples/with-bilig-workpaper-mcp/README.mdexamples/with-bilig-workpaper-mcp/src/mcp.ts
✅ Files skipped from review due to trivial changes (1)
- examples/with-bilig-workpaper-mcp/README.md
There was a problem hiding this comment.
2 issues found across 2 files (changes from recent commits).
Tip: Review your code locally with the cubic CLI to iterate faster.
Re-trigger cubic
There was a problem hiding this comment.
1 issue found across 3 files (changes from recent commits).
Prompt for AI agents (unresolved issues)
Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.
<file name="examples/with-bilig-workpaper-mcp/src/proof.ts">
<violation number="1" location="examples/with-bilig-workpaper-mcp/src/proof.ts:259">
P2: Cleanup error in `finally` block can mask the actual proof failure</violation>
</file>
Tip: Review your code locally with the cubic CLI to iterate faster.
Re-trigger cubic
| try { | ||
| await runProofWithWorkpaper(workpaperPath); | ||
| } finally { | ||
| await rm(tempDir, { recursive: true, force: true }); |
There was a problem hiding this comment.
P2: Cleanup error in finally block can mask the actual proof failure
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At examples/with-bilig-workpaper-mcp/src/proof.ts, line 259:
<comment>Cleanup error in `finally` block can mask the actual proof failure</comment>
<file context>
@@ -246,6 +249,17 @@ async function runProof() {
+ try {
+ await runProofWithWorkpaper(workpaperPath);
+ } finally {
+ await rm(tempDir, { recursive: true, force: true });
+ }
+}
</file context>
| await rm(tempDir, { recursive: true, force: true }); | |
| try { | |
| await rm(tempDir, { recursive: true, force: true }); | |
| } catch { | |
| // Best-effort cleanup; don't mask proof failures. | |
| } |
Summary
examples/with-bilig-workpaper-mcp, a VoltAgent MCP example for formula-backed workbook automation.@bilig/workpaper@0.154.0throughMCPConfigurationusing stdio andnpm exec.pnpm proofscript that calls the MCP tools directly, editsInputs!B3, verifies recalculatedSummary!B3, exports the WorkPaper document, and confirms restart readback.examples/README.md.Reviewer follow-up
@bilig/workpaper@0.154.0.Validation
npm view @bilig/workpaper version->0.154.0pnpm --dir examples/with-bilig-workpaper-mcp buildpnpm --dir examples/with-bilig-workpaper-mcp proofpnpm exec biome check examples/with-bilig-workpaper-mcp/src/mcp.ts examples/with-bilig-workpaper-mcp/src/proof.ts examples/with-bilig-workpaper-mcp/src/index.ts examples/with-bilig-workpaper-mcp/tsconfig.json examples/with-bilig-workpaper-mcp/README.md examples/README.mdgit diff --checkThe no-key validation run discovers 8 Bilig MCP tools, changes the demo win-rate input, reads
Summary!B3as96000, verifies persisted readback, and verifies the same value after reconnecting.Notes
The example intentionally does not add
@bilig/workpaperas a package dependency. The MCP command usesnpm exec --package @bilig/workpaper@0.154.0so the example is reproducible while still matching the current published Bilig runtime.