S1000D Writer (S1000D Stack)

v0.18.0
io.github.shuji-bonji/s1000d-writer-mcp Checked 1 day ago Published 1 hour ago

Builds S1000D data modules from structured drafts, verifies them, applies only unambiguous fixes.

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

build_data_module

Build ONE S1000D data module (descript / proced / process / fault) or publication module (pm) from a structured draft and number it from the allocation rules. You give titles, paragraphs, steps, tables, figures and references as a tree; the server writes the XML (you never write XML, DMCs, ICNs or the BREX reference). The XML is verified (XSD, BREX along the brexDmRef chain, references; applicability too when a product is given); fixes the server is certain about (confidence "exact") are applied automatically and verified again, up to maxFixRounds times. Returns xml, fileName, dmCode (pmCode f…

convert_manual

Convert an experiential operation manual (@shuji-bonji/experiential-manual-model JSON) into S1000D: one publication module, one data module per topic (description → descript, procedure → proced, troubleshooting → fault, screenFlow → process plus one proced per screen), a glossary data module, applicability from the scopes, and ICNs for the assets. Every data module goes through the same flow as build_data_module (build, verify, automatic exact fixes, verify again); references between the data modules are resolved against the CSDB plus the data modules built in this call. A topic whose…

apply_fixes

Apply fixes to an existing data module. Each selection copies the location and ONE candidate of a fix that s1000d-verify-mcp suggest_fixes (or this server) returned: { location, action, target?, value?, position? }. The server computes the fix candidates again and applies a selection only if it matches one of them; a value outside the candidates (or outside a range / pattern candidate) is not applied and comes back in rejected[] with the reason. "provide" candidates change the product, not the document: pass them as "product". The result is verified again. Returns xml, applied[], rejected[], v…

ParameterTypeDescription
selections *array
allowInvalidbooleanWith write: true, write even when verification.schema.state is "invalid". Default false.
csdbDirsarrayCSDB folders used to resolve references, find BREX and number new objects (default: S1000D_CSDB_DIR / the config file). The FIRST folder is also where write: true writes (it may not exist yet). When g…
maxFixesintegerCap on the remaining fixes listed in the response (default 50).
overwritebooleanWith write: true, replace a file of the same name. Default false: an existing file is left alone and reported as write-conflict.
pathstringFile path of the document.
productobjectThe product to evaluate applicability for. attributes: ACT productAttribute id → value; conditions: CCT cond id → value. Omit to skip the applicability check.
writebooleanWrite the result into the CSDB (the first folder of csdbDirs / S1000D_CSDB_DIR). Default false: the XML is only returned. Nothing is written when the XML is not valid against the XSD unless allowInval…
xmlstringAn existing document as an XML string (alternative to path; max 5 MB). Not for XML you wrote yourself: build new data modules with build_data_module.

edit_data_module

Change the structure of an EXISTING procedural or descriptive data module: insert a node, remove a node, move a node. Places are location.path values of the document as it is now (s1000d-reader-mcp read_data_module returns them); with several edits, every place still refers to the document before any edit. A node to insert is a structured draft node (step / para / admonition / listItem), never XML. All edits are applied or none: refusals[] gives the reason per edit (for example id-referenced, not-allowed-here, unsupported-node, released-issue). Only the edited ranges of the original text are r…

start_revision

Start an in-work issue of a RELEASED data module (issueInfo/@inWork "00") so that it can be changed by the S1000D rules. The result is a NEW document: issueNumber unchanged, inWork "01", issueType as given; the released issue is never changed. The change markup of the previous issue is removed (changeType / changeMark / reasonForUpdateRefIds, changeInline tags with their text kept, every reasonForUpdate) and elements marked changeType="delete" are removed; only those ranges of the original text are rewritten. issueType is REQUIRED and is the user's decision: "changed" (changes shown with chang…

ParameterTypeDescription
issueType *stringissueType of the in-work issue. Ask the user; it is never chosen for you. "new" is accepted only when starting from 001-00 (it follows Chap 3.9.5.1 Table 3 but the default BREX reports BREX-S1-00030).
allowInvalidbooleanWith write: true, write even when verification.schema.state is "invalid". Default false.
csdbDirsarrayCSDB folders used to resolve references, find BREX and number new objects (default: S1000D_CSDB_DIR / the config file). The FIRST folder is also where write: true writes (it may not exist yet). When g…
includeXmlbooleanInclude the XML in the response (default: true when write is false, false when write is true).
maxFixesintegerCap on the remaining fixes listed in the response (default 50).
overwritebooleanWith write: true, replace a file of the same name. Default false: an existing file is left alone and reported as write-conflict.
pathstringFile path of the document.
productobjectThe product to evaluate applicability for. attributes: ACT productAttribute id → value; conditions: CCT cond id → value. Omit to skip the applicability check.
qualityAssurancestringOptional: "unverified" sets qualityAssurance back to unverified, for a change that needs re-verification (Chap 3.7 Para 2.3). Ask the user whether the change needs re-verification; do not decide it. O…
reasonobjectOptional: one reason for update to add to the in-work issue (same as add_reason_for_update). If it cannot be added, the in-work issue is not started either.
writebooleanWrite the result into the CSDB (the first folder of csdbDirs / S1000D_CSDB_DIR). Default false: the XML is only returned. Nothing is written when the XML is not valid against the XSD unless allowInval…
xmlstringAn existing document as an XML string (alternative to path; max 5 MB). Not for XML you wrote yourself: build new data modules with build_data_module.

add_reason_for_update

Add ONE reason for update (reasonForUpdate) to the status element of an IN-WORK data module, and nothing else: the content is not touched and no change markup is added. Use it for a change that has no change markup: an editorial change (updateReasonType urt01), or an issue whose issueType is revised or status. For a change that IS shown with change markup, do not use this tool: pass marking.reason to edit_data_module, which adds the reason and the markup together. A reason added here can be referred to by later marked edits through marking.reasonRefId (not a urt01 reason). The text and updateR…

ParameterTypeDescription
reason *objectOne reason for update (reasonForUpdate in the status element). The text and the type are the user's: never fill them in.
allowInvalidbooleanWith write: true, write even when verification.schema.state is "invalid". Default false.
csdbDirsarrayCSDB folders used to resolve references, find BREX and number new objects (default: S1000D_CSDB_DIR / the config file). The FIRST folder is also where write: true writes (it may not exist yet). When g…
includeXmlbooleanInclude the XML in the response (default: true when write is false, false when write is true).
maxFixesintegerCap on the remaining fixes listed in the response (default 50).
overwritebooleanWith write: true, replace a file of the same name. Default false: an existing file is left alone and reported as write-conflict.
pathstringFile path of the document.
productobjectThe product to evaluate applicability for. attributes: ACT productAttribute id → value; conditions: CCT cond id → value. Omit to skip the applicability check.
writebooleanWrite the result into the CSDB (the first folder of csdbDirs / S1000D_CSDB_DIR). Default false: the XML is only returned. Nothing is written when the XML is not valid against the XSD unless allowInval…
xmlstringAn existing document as an XML string (alternative to path; max 5 MB). Not for XML you wrote yourself: build new data modules with build_data_module.

release_issue

Release an IN-WORK data module or publication module (issueInfo/@inWork other than "00"): the result is a NEW document with issueNumber + 1, inWork "00" and the given issueDate (000-NN becomes 001-00, 005-01 becomes 006-00). The in-work issue is never changed. Only those attribute values (and qualityAssurance, when asked) are rewritten in the original text; change markup and reasons for update are kept, because they describe this issue (start_revision removes them when the next revision starts). issueDate (YYYY-MM-DD) and qualityAssurance are REQUIRED and are the user's: the meaning of the iss…

ParameterTypeDescription
issueDate *stringIssue date of the released issue, YYYY-MM-DD. Ask the user: what the date means (release to the CSDB, a delivery cut-off, …) is a project decision (BRDP-S1-00049). It is never filled in with today's…
qualityAssurance *QA status written to the released issue. "unverified": not verified. {first, second?}: the method of the first (and second) verification — tabtop (table top), onobject (on the Product), ttandoo (bot…
csdbDirsarrayCSDB folders used to resolve references, find BREX and number new objects (default: S1000D_CSDB_DIR / the config file). The FIRST folder is also where write: true writes (it may not exist yet). When g…
includeXmlbooleanInclude the XML in the response (default: true when write is false, false when write is true).
issueTypestringOnly when the in-work issue is still "new" and is released as issue 002 or later (from 002 on, issueType must not be "new"). Ask the user. In every other case omit it: issueType is not changed on rele…
maxFixesintegerCap on the remaining fixes listed in the response (default 50).
overwritebooleanWith write: true, replace a file of the same name. Default false: an existing file is left alone and reported as write-conflict.
pathstringFile path of the document.
productobjectThe product to evaluate applicability for. attributes: ACT productAttribute id → value; conditions: CCT cond id → value. Omit to skip the applicability check.
writebooleanWrite the result into the CSDB (the first folder of csdbDirs / S1000D_CSDB_DIR). Default false: the XML is only returned. Nothing is written when the XML is not valid against the XSD unless allowInval…
xmlstringAn existing document as an XML string (alternative to path; max 5 MB). Not for XML you wrote yourself: build new data modules with build_data_module.

create_comment

Build a comment data module (comment.xsd): a remark about data modules, publication modules, DMLs or DDNs, with the type (q / i / r), the priority code (cp01–cp99), paragraphs, the originator and the sender. The enumerations are written as given and not interpreted. The sequence number defaults to the next free one in the CSDB. The XML is verified (comment.xsd, BREX). Returns xml, fileName, commentCode, verification, fixes[]. Writes only when write is true.

extract_segments

Take the sentences that a person reads out of a data module so they can be translated: titles, paragraphs, step texts, warnings / cautions / notes, table cells and figure captions. Each segment has a stable id, its XPath, a context hint and the text, with inline elements (emphasis, references …) replaced by {1}, {2} placeholders that must stay in the translation. Attribute values, DMCs, ICNs, applicability expressions and ids are never offered. Also returns the skeletonHash to pass to apply_segments. The server does not translate and does not score translations.

ParameterTypeDescription
includearrayWhich kinds of sentences to return (default: all).
maxSegmentsintegerCap on the number of segments returned.
pathstringFile path of the document.
xmlstringAn existing document as an XML string (alternative to path; max 5 MB). Not for XML you wrote yourself: build new data modules with build_data_module.

apply_segments

Put translated sentences back into the data module they were taken from. The output has the same DMC with only the language changed (issueInfo too if given). It stops with error.code "skeleton-mismatch" when the data module changed since extract_segments (skeletonHash). A segment whose id is unknown, duplicated, or whose {n} placeholders do not match is not applied and is listed in unapplied[] (the original sentence stays). The result is verified. Writes only when write is true.