Skip to main content

Module handler

Module handler 

Source
Expand description

The curated workbook tool handlers (WBSV-01/02/03/04): calculate, explain, get_manifest, diff_version.

All are native pmcp::ToolHandler impls registered via tool_arc and pmcp::types::ToolInfo::with_ui (so the returned Value lands in structuredContent). Each attaches the provenance stamp and advertises a non-empty outputSchema (WBSV-07). Domain failures return the isError:true envelope via to_iserror_result — NEVER a protocol-level error (T-92-10).

The per-Table WorkbookToolHandlers (WBV2-04) + explain re-run the SERVE-time pmcp_workbook_runtime::run_executor over the pre-built bundle.dag (no compiler, no second evaluator), seeding the CellEnv via the embedded cell_map. Each per-Table handler projects ONLY its own Table’s outputs via [project_tool_outputs] — one named MCP tool per output Table.

Structs§

DiffVersionHandler
The diff_version handler (WBSV-04): serve the RECORDED prev→current pmcp_workbook_runtime::VersionChangelog the offline promote step folded into the bundle (hash-verified at boot — NOT a runtime computation), stamped.
ExplainHandler
The explain handler (WBSV-02): a stateless re-run that renders the derivation trace as ordered business-language steps, plus a GENERIC manifest-declared annotations object (S-2 — any domain-specific keystone is generalized into manifest-declared annotations; the engine reads only manifest.annotations names, nothing domain-specific).
GetManifestHandler
The get_manifest handler (WBSV-03): a CURATED agent-facing projection — inputs (tier+default+unit), outputs (unit/meaning), governed-data summary, versions/hashes, changelog — NOT the raw internal manifest.
RenderWorkbookHandler
The render_workbook handler (WBSV-05): validate the inputs, then return a provenance-bound workbook:// URI POINTER — NOT the .xlsx bytes. The bytes are recomputed per resources/read by super::render_resource from the decoded URI (stateless regen-on-read, Lambda-safe, V3).
WorkbookToolHandler
One served MCP tool per output Table (WBV2-04): validate → seed via cell_map → re-run the embedded IR → project ONLY this tool’s outputs (finite) → stamp.

Functions§

sanitize_tool_name
Sanitize a raw output-Table name into an MCP tool name matching ^[a-zA-Z0-9_-]{1,64}$ (T-100-10), wrapping the SINGLE shared runtime sanitizer (pmcp_workbook_runtime::sanitize_tool_name) so the served registration and the offline compiler’s collision lint cannot drift on the locked five-rule semantics (lowercase, illegal-run → single _, trim edges, truncate 64, reject empty/all-illegal). A reject becomes the fail-closed invalid_tool_name domain error.