passwerk

v0.1.1
io.github.ShahriarBijoy/passwerk Checked 18 hours ago Published 2 months ago

Offline EU Battery Passport compiler: ingest documents, map, validate (IDTA 02035), emit AASX.

These tools were reported by the server itself during our smoke test (tools/list), not copied from the README.

ingest_documents Ingest supplier documents

Reads PDF, XLSX, CSV, DOCX and TXT documents into a DocumentBundle with page, line, table and cell provenance, deterministically and without OCR or a model. Returns a per-document summary and a bundleId to pass to extract_facts; ask for detail "full" to see the pages. Unsupported or unreadable files are reported, not dropped.

ParameterTypeDescription
detailstringsummary (default): per-document counts and the bundleId; full: the whole DocumentBundle
inlinearrayDocument bytes as base64, for hosts that cannot pass paths
langstringLanguage of the text summary (default en)
limitsobjectPartial IngestLimits override (maxInputBytes, maxCells, ...)
pathsarrayFiles or directories on the server’s file system (a directory contributes its PDF, XLSX, CSV, DOCX and TXT files, non-recursive). Preferred for local installs

extract_facts Extract facts

Turns a DocumentBundle into a FactSet: labelled values with normalised numbers, units and dates, each with file, page, line or cell provenance. Pure heuristics, no model. Returns the FactSet and a factSetId to pass to suggest_mappings.

ParameterTypeDescription
bundle *A DocumentBundle object, or { bundleId } as returned by ingest_documents
langstringLanguage of the text summary (default en)

suggest_mappings Suggest attribute mappings

Scores every fact against the knowledge-base synonym index (DE/EN), unit and type checks and the attribute range, and returns candidate mappings sorted by confidence with a DE/EN explanation and provenance. Review proposals under 0.7 with the user or the source page, then pass the accepted ones to apply_mappings. Ask for detail "full", or pass attributeIds, to see every candidate with its file, page and cell in the text.

ParameterTypeDescription
category *stringPassport category; decides applicability
facts *A FactSet object, or { factSetId } as returned by extract_facts
attributeIdsarrayKeep only proposals for these attribute ids; unknown ids are reported, not an error. When given, the text lists every match, not just the first 10, with provenance, even in summary mode
detailstringsummary (default): header line plus the first 10 proposals, no provenance. full: every proposal after the filters, one line each, with provenance (file, page, cell); no cap
langstringLanguage of the text summary (default en)
minConfidencenumberDrop proposals below this confidence (default 0). 0.7 is the review threshold

apply_mappings Apply mapping decisions

Folds accepted mapping decisions (or manual values) into a PassportDraft. Idempotent: the same decision twice is a no-op; a different value for an attribute that already has one is reported as a conflict and not applied unless override is true. Pass meta instead of draft to start a new draft.

ParameterTypeDescription
mappings *arrayAccepted proposals from suggest_mappings, or manual values
draftThe draft to extend. Omit and pass meta to start a new one
langstringLanguage of the text summary (default en)
metaobjectStarts a new draft. Exactly one of draft or meta

validate_passport Validate a passport draft

Runs all four validation layers on a PassportDraft: L1 schema, L2 AAS meta-model (aas-core), L3 IDTA 02035 template conformance, L4 domain plausibility. Returns the verdict (valid, valid_with_warnings, invalid) and every finding with layer, rule id, path, DE/EN message, legal reference and fix hint. The only source of a validity claim.

ParameterTypeDescription
draft *A PassportDraft object, or { draftId } as returned by an earlier call
asOfstringISO date-time treated as "now" by the plausibility layer; default: draft.meta.createdAt
langstringLanguage of the text summary (default en)
skipPlausibilitybooleanSkip L4 (domain plausibility). Default false

gap_report Gap report

The to-do list for a PassportDraft: every attribute bucketed as required, conditional, deferred or optional with status, legal references, who typically has the data and a suggested action; completeness for mandatory and overall data points, grouped by submodel and by data owner. Runs validate_passport first so invalid values count as gaps. Ask for detail "full" and a status/bucket filter to see every open attribute with its legal reference and next action, unabridged, for use without the structured content. Not legal advice.

ParameterTypeDescription
draft *A PassportDraft object, or { draftId } as returned by an earlier call
asOfstringISO date-time treated as "now" for applicability; default: draft.meta.createdAt
bucketarrayKeep only items in one of these buckets; completeness stays unfiltered
detailstringsummary (default): open mandatory items, capped at 10. full: every item after the status/bucket filters, grouped by data owner, one line each with status, bucket, legal refs and the suggested next act…
langstringLanguage of the text summary (default en)
statusarrayKeep only items with one of these statuses; completeness stays unfiltered

review_passport Review a passport in the workbench

Opens the interactive passwerk workbench in hosts that render MCP Apps (Claude Desktop, Claude web): upload documents, accept or edit mapping proposals, read the gap report and export, all on the user’s machine. Pass the current draft so the user reviews it visually; the workbench keeps the draft id in sync so gap_report and emit_passport can continue on it. Hosts without a UI receive the same draft, validation report and gap report as text.

ParameterTypeDescription
draftThe draft to review; omit to open an empty workbench
factsExtracted facts to review alongside the draft
langstringLanguage of the text summary (default en)

emit_passport Emit the passport files

Emits a PassportDraft as AAS JSON (IDTA 02035 submodels), an AASX package, the draft JSON and/or the HTML sheet, and re-validates the emitted output. Fail-honest: files are returned even when the verdict is invalid, and the verdict is never better than validate_passport’s. Bytes come back base64 inline unless outDir is given.

ParameterTypeDescription
draft *A PassportDraft object, or { draftId } as returned by an earlier call
targets *arrayaas-json: AAS v3 JSON environment (IDTA 02035); aasx: AASX package; draft-json: the neutral PassportDraft; html: self-contained HTML passport sheet (DE and EN inside)
asOfstringISO date-time treated as "now" by the re-validation
htmlLangstringLanguage the html sheet opens in (both are in the file; default en)
langstringLanguage of the text summary (default en)
outDirstringDirectory to write into (needs a file system). Omit to receive base64 bytes inline

generate_carrier Generate the data carrier (QR code)

Builds the data carrier for a passport: the unique identifier (the draft’s passportId, an absolute https URI), an optional GS1 Digital Link (/01/{gtin}/21/{serial} or /8004/{giai}) and the QR code as SVG or PNG. The QR encodes the Digital Link when GS1 data is given, else the identifier. Says nothing about validity; validate_passport does.

ParameterTypeDescription
draftThe draft whose meta.passportId is the identifier
formatstringImage format (default svg)
gs1GS1 key: GTIN (8, 12, 13 or 14 digits) plus serial, or a GIAI
langstringLanguage of the text summary (default en)
outDirstringDirectory to write the image into (needs a file system). Omit to receive base64 bytes inline
resolverBasestringhttps base of the GS1 Digital Link resolver; required with gs1
uidstringThe passport identifier (absolute https URI) when no draft is given

check_obligations Check battery passport obligations

Whether a battery passport is required for a battery type, role, energy and market date under Regulation (EU) 2023/1542 Article 77(1); returns the category, the mandatory, conditional and deferred attribute sets and the legal timeline. Answers required, not_required or insufficient_input. Not legal advice.

ParameterTypeDescription
batteryType *stringBattery type as placed on the market
role *stringEconomic operator role of the asker
asOfstringISO date treated as "now"; default: the server clock
energyKwhstringBattery energy in kWh as a decimal string, e.g. "2.5". Decides the industrial 2 kWh threshold
langstringLanguage of the text summary (default en)
placedOnMarketDatestringISO date the battery is or was placed on the market or put into service

explain_attribute Explain an attribute or rule

Everything the knowledge base holds about one passport attribute (official DIN definition, DE/EN explanation, synonyms, who typically has the data, unit, range, applicability per category, legal references, IDTA template elements) or one plausibility rule (message, fix hint, legal reference). Nothing is composed; unknown ids are an error.

ParameterTypeDescription
id *stringA knowledge-base attribute id (e.g. "batteryChemistry") or a rule id (e.g. "PW-PLAUS-001")
langstringLanguage of the text summary (default en)

list_capabilities List capabilities

Versions of the bundled IDTA 02035 templates and AAS schemas, knowledge-base statistics, when the artefacts were retrieved, the sovereignty statement, and this server’s tools and session-store usage. Call first to learn what this server can do.

ParameterTypeDescription
langstringLanguage of the text summary (default en)