Skip to content

acture/lite: commands as tools without Zod (jsonParams, toolDefs) - #119

Merged
thorwhalen merged 1 commit into
mainfrom
feat/lite-tool-defs
Dec 2, 2026
Merged

thorwhalen merged 1 commit into
mainfrom
feat/lite-tool-defs

Conversation

@thorwhalen

Copy link
Copy Markdown
Member

Closes #110.

A page on acture/lite (no Zod, no build step) can now hand its commands to an agent as tools, with no side map of schemas beside the records:

  • ParamSchema gains an optional jsonSchema: the JSON Schema the params schema stands for, stated rather than converted. toJsonSchema uses it as it is, so acture-mcp-server and acture-ai-vercel honour it with no change (their tests pass unchanged).
  • jsonParams(schema, { check? }) (in acture/lite and acture) builds such a params schema. At dispatch it runs a shallow check (an object, the required keys, each top-level property's type and enum); check replaces it (a full validator, or () => [] for none).
  • toolDefs(registry, listOptions?) returns { name, description, inputSchema } per listed command, named by commandIdToToolName (re-exported from acture/lite with buildToolNameToIdMap), with the same deprecation banner the MCP adapter adds. A command whose params carry no jsonSchema is an error naming it.

Answers to the two questions in the issue: a stated schema is now validated at dispatch in lite, shallowly by default and pluggably. A ready-to-load single script is not added: the built ESM files load in a page as they are (<script type="module"> importing dist/lite.js and its chunks), which is what the pages that asked for this do.

Size: createRegistry, defineCommand, ok, err from acture/lite stays at 2895 B (budget 2900; a top-level Object.freeze was turned into a function so it tree-shakes). The new path, adding jsonParams, toolDefs, is 4785 B min / 2262 B gzip, with its own budget of 4900 B in size-budget.json.

Checks run locally: core vitest 207 passed (6 new in tool-defs.test.ts), tsc --noEmit clean, size-budget.mjs ok; acture-mcp-server 50 passed and acture-ai-vercel 15 passed against the changed core.

A params schema may state its JSON Schema (ParamSchema.jsonSchema); every
projection, toJsonSchema included, uses it as it is. jsonParams builds one,
with a shallow check at dispatch. toolDefs(registry) projects listed commands
to { name, description, inputSchema }, named by commandIdToToolName.

Closes #110
@thorwhalen
thorwhalen merged commit b16dab8 into main Dec 2, 2026
2 checks passed
@thorwhalen
thorwhalen deleted the feat/lite-tool-defs branch December 2, 2026 20:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Component: tool definitions (name, description, JSON Schema) from an acture/lite registry on a page with no build step

1 participant