Skip to main content

Module tools

Module tools 

Source
Expand description

The MCP tools and prompts of TeamCraft.

Every tool calls the same services::* functions as the REST API, with the rights of the signed-in user. Results are compact JSON (item numbers and revision codes instead of ids) so they fit an assistant’s context; long lists are capped and flagged with truncated.

Writes only prepare work: a draft change order and its affected revisions, a new change request (which every signed-in user may raise) and comments on one. Submitting, reviewing, releasing, making obsolete and triaging or deciding change requests are not offered – those decisions stay with people.

Structs§

Args
Typed access to the arguments object of a tool call.
FileState
A file of a revision as far as the comparison is concerned.
LineState
A BOM line as far as the comparison is concerned.
Snapshot
What compare needs of a revision.

Constants§

MAX_BOM_ROWS
Most rows of an expanded BOM in one result.
MAX_LIST
Most entries of other lists in one result.
MAX_PREVIEW_CANDIDATES
Most candidates listed when the search text matches several items.
MAX_TEXT_BYTES
Upper bound for the text of one result; longer output is cut.

Functions§

call
tools/call: runs a tool and wraps the outcome as CallToolResult.
call_logged
call on behalf of a real user, with the read log of need-to-know groups (services::access_log::record_tool_read): a successful read tool that named an item of a group that logs reads leaves an entry with the channel of log (MCP client or assistant). A read that cannot be logged is not handed out, like a download.
checked_viewer_path
Checks a viewer URL from a tool result before anything shows it: it must be this server’s 3D viewer page of a file – a relative /files/<uuid>/preview or the same under public_url (same scheme, host and port). Returns the relative path in canonical form; anything else (other hosts, //host, queries, fragments, encodings, other pages) is None.
compare
What changed from old to new: attributes, files (matched by name, compared by content hash) and BOM lines (matched by child item).
definitions
tools/list.
definitions_for
tools/list for a token scope: a read_only token sees the read-only tools only.
diff_brief
One matched result value of simulations::compare_results.
exists
failure
A failed CallToolResult: the assistant sees the message and can react.
group_based
The basis links of one simulation, grouped (the service returns one row per link, ordered by simulation number).
group_duplicates
Duplicate contents grouped by SHA-256 (largest first, as returned).
is_read_only
Whether a tool only reads (false for an unknown name).
parse_item_ref
PRT-000012 or PRT-000012/B → number and optional revision code. Item numbers never contain a slash.
preview_action
The action hint of a viewer URL.
prompt
prompts/get: the prompt as one user message.
prompts
prompts/list.
request_reason
request_scope
The scope argument: mine → (requested by me, –), assigned → (–, assigned to me), none → no filter.
request_status_filter
The status argument of list_change_requests: a status, open (not finished) or all (default) → (status filter, open only).
success
A successful CallToolResult: the value as JSON text and as structured content (non-objects are wrapped in {"result": …}). Output above MAX_TEXT_BYTES is cut and the structured copy left out.
viewer_path
The path of the 3D viewer page of a file (the current version).