Skip to content

Commit 0c31dde

Browse files
vosesoftclaude
andcommitted
Release v0.3.0-alpha.28: diagnose_workbook reports correct path
Bug #30: diagnose_workbook always assigned active_workbook and workbook_path from Excel's currently-active book, regardless of which workbook the caller asked to diagnose. So calling diagnose_workbook("foo.xlsx") while bar.xlsx was active in Excel reported active_workbook="bar.xlsx" and workbook_path=<bar's path> alongside foo's input/output counts. Worse, the .vmrs lookup used workbook_path (bar's) so it would silently find bar's sibling vmrs instead of foo's. Fix: when an explicit workbook_name is supplied, look up that book's path from list_workbooks and report it. active_workbook still reflects Excel's active book (informational), workbook_path now consistently describes the diagnosed workbook. 404 tests pass. Verified live via the round-2 test pass on the real workbooks. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent bddf71d commit 0c31dde

7 files changed

Lines changed: 54 additions & 7 deletions

File tree

CHANGELOG.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,16 @@ All notable changes to ModelRisk MCP. Follows [Keep a Changelog](https://keepach
44

55
## [Unreleased]
66

7+
## [0.3.0-alpha.28] — 2026-05-22
8+
9+
### Fixed
10+
11+
- **Bug #30`diagnose_workbook` mixed data sources when called with an explicit `workbook_name`.** Prior versions always assigned `active_workbook = <Excel-active book's name>` and `workbook_path = <active book's path>`, regardless of which workbook the caller asked to diagnose. Result: calling `diagnose_workbook("foo.xlsx")` while `bar.xlsx` was active in Excel reported `active_workbook="bar.xlsx"` and `workbook_path=<bar's path>` alongside foo's input/output counts — misleading. Worse, the downstream `.vmrs` lookup used `workbook_path` (bar's) and would silently find bar's sibling vmrs instead of foo's. Fix: when an explicit `workbook_name` is supplied, look up that book's path from `list_workbooks` and report it in `workbook_path`. The `active_workbook` field still reflects Excel's active book (useful informationally), but `workbook_path` now consistently describes the workbook being diagnosed.
12+
13+
### Tests
14+
15+
404 unit tests pass. Live verification via the round-2 test pass.
16+
717
## [0.3.0-alpha.27] — 2026-05-22
818

919
### Fixed

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[project]
22
name = "modelrisk-mcp"
3-
version = "0.3.0a27"
3+
version = "0.3.0a28"
44
description = "Open MCP server bridging Anthropic Claude (and any MCP-compatible client) with the ModelRisk Excel add-in."
55
readme = "README.md"
66
requires-python = ">=3.11"

server.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,12 @@
33
"name": "io.github.vosesoftware/modelrisk-mcp",
44
"title": "ModelRisk",
55
"description": "Read, build, fit, and run Monte Carlo risk models in Excel through Vose Software's ModelRisk.",
6-
"version": "0.3.0a27",
6+
"version": "0.3.0a28",
77
"packages": [
88
{
99
"registryType": "pypi",
1010
"identifier": "modelrisk-mcp",
11-
"version": "0.3.0a27",
11+
"version": "0.3.0a28",
1212
"transport": {
1313
"type": "stdio"
1414
}

src/modelrisk_mcp/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
__version__ = "0.3.0a27"
1+
__version__ = "0.3.0a28"

src/modelrisk_mcp/tools/workflows.py

Lines changed: 38 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -205,13 +205,50 @@ def diagnose_workbook(
205205
}
206206
issues: list[str] = []
207207

208-
# 1. Excel reachability + active workbook
208+
# 1. Excel reachability + workbook resolution.
209+
#
210+
# Bug #30 (alpha.28): prior versions assigned
211+
# `active_workbook = active.name` and `workbook_path = active.path`
212+
# regardless of whether the caller passed an explicit
213+
# `workbook_name`. Result: calling `diagnose_workbook("foo.xlsx")`
214+
# while "bar.xlsx" was active in Excel would report
215+
# active_workbook="bar.xlsx" and workbook_path=<bar's path>
216+
# alongside foo's input/output counts — misleading by
217+
# construction. The downstream `.vmrs` lookup also used the wrong
218+
# path and would silently find bar's vmrs instead of foo's.
219+
#
220+
# Fix: when `workbook_name` is supplied, look up THAT book's path
221+
# from `list_workbooks` and report it. The `active_workbook` field
222+
# always reflects Excel's actually-active book (informational),
223+
# while `workbook_path` describes the diagnosed workbook.
209224
try:
210225
active = bridge.excel.get_active_workbook()
211226
out["excel_connected"] = True
212227
wb_name = workbook_name or active.name
213228
out["active_workbook"] = active.name
229+
# Default to active.path; override below if a specific
230+
# workbook was named.
214231
out["workbook_path"] = active.path
232+
if workbook_name and workbook_name != active.name:
233+
try:
234+
target = next(
235+
(b for b in bridge.excel.list_workbooks()
236+
if b.name == workbook_name),
237+
None,
238+
)
239+
if target is None:
240+
issues.append(
241+
f"Workbook {workbook_name!r} is not currently "
242+
f"open. The diagnose result will reflect the "
243+
f"empty fallback values."
244+
)
245+
else:
246+
out["workbook_path"] = target.path
247+
except Exception:
248+
# If list_workbooks fails, keep the active.path
249+
# default; the input counts below will still
250+
# be sourced from the requested workbook name.
251+
pass
215252
except Exception as exc:
216253
issues.append(f"Excel not reachable: {exc!s}")
217254
out["issues"] = issues

tests/unit/test_server_boot.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66

77
def test_version_is_set() -> None:
8-
assert __version__ == "0.3.0a27"
8+
assert __version__ == "0.3.0a28"
99

1010

1111
def test_server_name() -> None:

uv.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)