toolmark-monorepo / @toolmark/inertia / propsTools
Function: propsTools()
propsTools(
tm,entries,scope,opts):void
Defined in: packages/inertia/src/props-tools.ts:281
Registers server-declared tools (spec §10.1, §12.4) into scope. Every entry is untrusted: an entry that is not a valid PropsToolEntry (bad name, empty description, schema outside the fromJsonSchema subset, unknown method, non-same-origin URL, …) is skipped with an error event invalid_props_tool. Hardening (all invalid_props_tool): title ≤ MAX_PROPS_TOOL_TITLE_LENGTH, description ≤ MAX_PROPS_TOOL_DESCRIPTION_LENGTH, serialized inputSchema ≤ MAX_PROPS_TOOL_SCHEMA_LENGTH, at most MAX_PROPS_TOOLS_PER_PAGE entries (the rest skipped with one event); a non-get entry's schema root must be { type: 'object', additionalProperties: false }; no schema may declare the reserved keys _method/_token, and input carrying them at any depth is invalid. The visit URL is resolved once, at registration, to its canonical absolute form. A name already taken (by any tool, or its LLM name) is skipped with duplicate_name. Nothing is ever thrown, in development or production. Tools carry origin: 'server', validate input with fromJsonSchema(inputSchema) and run router.visit(url, { method, data: input, preserveState: true, ...callbacks }), settling through the per-visit callbacks (finish alone is an error, never ok).
Parameters
tm
The registry.
entries
unknown[]
Untrusted entries (typically page.props.toolmark).
scope
Target scope (normally a transparent page scope, so names stay as the server gave).
opts
The router, and an optional signal that cancels in-flight visits.
Returns
void