npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@haneinfo/mcp-generated-tools

v0.3.8

Published

Per-machine MCP read tools generated from published StateMachine declarations, as thin wrappers of the existing list, read, search and report paths.

Readme

@haneinfo/mcp-generated-tools

Per-machine MCP read tools generated from published StateMachine declarations (draft decision 202610-c5e8; the decision remains draft). Instead of calling the generic query_instance_list, search_instances or run_report_query with a free-form machine code and filter object, an agent gets tools whose input schema already lists the machine's fields, operators, options and sortable columns:

| Tool | Wraps | Required scope (copied from the wrapped path) | | --- | --- | --- | | list_<name> | query_instance_list (list-view) | <namespace>:list-view:read | | get_<name> | StateMachineRuntime.getFor (same read as GET /state-machine-instances/:id) | <namespace>:instance:read | | search_<name> | search_instances (search) | <namespace>:search:read | | report_<name> | run_report_query (instance-analytics) | <namespace>:reports:read |

Every generated tool is a thin wrapper: it validates its typed input, translates it into the standard call of the wrapped path and adds schemaVersion and machineCode to the result. It never reads the database itself, so permissions, readership, archive and soft-delete behaviour and $userContent wrapping are exactly those of the wrapped path. Write tools are never generated.

Opting in

Nothing is generated unless a StateMachine declares spec.mcp (state-machine 0.23):

"mcp": { "tools": ["list", "get", "search", "report"], "toolName": "loan" }
  • search needs spec.search.fields, report needs spec.reporting; the definition registry rejects the declaration otherwise (MCP_TOOL_DECLARATION_REQUIRED). Duplicates are rejected.
  • toolName is the name fragment (^[a-z][a-z0-9_]*$, at most 32). Without it the code is used in lower case with every other character turned into _ (equipment-loan-flow → equipment_loan_flow), which must also fit 32 characters.
  • Names, including <MCP_TOOL_PREFIX>_ when prefixed aliases are on, are at most 64 characters.

Input schemas

All schemas are strict (additionalProperties: false at every level). When invoked through the @haneinfo/mcp-server 4.0 command executor, inputSchema is validated after authorization and invalid arguments return { isError: true, content: [{ type: 'text', text: 'Invalid tool arguments' }] }. Direct callers validating against the exported schemas receive structured UNKNOWN_FIELD or INVALID_INPUT errors.

  • list_<name>: filters (object keyed by filterable list-view field id: the system fields $state (an enum of the machine's state keys), $number, $submitterId, $createdAt, and the spec.listView fields declared filterable), sort ([{ fieldId, direction }], sortable ids only), columns (every list field id), archived (exclude / include / only), limit (1–500), offset.
  • get_<name>: id.
  • search_<name>: q, archived, limit (1–200), offset; the machine code is fixed.
  • report_<name>: measures (enum of count and <op>:<field id> for $leadTime and every declared measure operation, 1–8), groupBy (enum of $state, $submitterId, $createdAt:<day|week|month|quarter|year>, $archived and declared dimensions, at most 3), filters (as for list) and limit.

A filter value is a bare scalar (equality), { op, value }, { op: "in", value: [1–100] } or { op: "notEmpty" }. Comparison operators are eq/neq for text, textarea and select, and also gt/gte/lt/lte for number, date and datetime; switch fields take a boolean only. Dates and datetimes use Form's strict comparison formats. The exact JSON Schema per field type is pinned by MCP_GENERATED_FILTER_SCHEMA_TEST_VECTORS in @haneinfo/plugin-api, and this package's tests check that the zod schemas produce exactly those. Filters become one list-view PREDICATE per entry, joined with AND, and are validated again by list-view.

Field labels, option labels, state labels and the machine name are user content: they are cleaned (control characters and line breaks removed), cut to 80 (labels) or 100 (machine name) code points, JSON-quoted and placed only in description texts; they never become instructions or property names. Fields that are not declared never appear in a schema.

Results

The result of the wrapped path, unchanged, plus schemaVersion (<machine version>.<subject Form version>) and machineCode. get_<name> returns instance (id, state, revision, submitterId, submitterName and data as $userContent, timestamps, finished, archived, archivedAt and the caller's canArchive / canUnarchive / canDelete / canEdit) and history as $userContent. Unreadable, deleted and other machines' ids are INSTANCE_NOT_FOUND. Every tool is user-bound: a credential without an acting user gets FORBIDDEN.

Generation and updates

Tools are generated on application bootstrap from each machine's latest published definition and its subject Form, then recomputed at most once per refreshSeconds on the next MCP request (or diagnostics read). A recomputation that fails keeps the previous tools and is reported as lastError. When a declaration is removed the tool disappears and a call answers tool_unavailable. The service implements @haneinfo/commands DynamicCommandSource and is served through the command registry (@haneinfo/mcp-server 4.0 calls commands.refreshSources() before tools/list and tools/call). Modern (per-request) MCP requests always see the current tools; a 2025-era session keeps the tool list it was initialized with, but every call runs the current definition and a removed tool answers tool_unavailable. The session's original input schema still validates calls after an update: new arguments may be rejected before reaching the current handler, while arguments accepted by the old schema reach that handler. Reconnect and retrieve the list to obtain updated schemas and new tools.

A name already registered by a hand-written command (or generated earlier for another machine) is not generated (NAME_CONFLICT, logged once). At most maxMachines opted-in machines get tools, by code order (MACHINE_LIMIT). A list schema above maxSchemaBytes drops the columns enum (COLUMNS_ENUM_OMITTED warning); a schema still too large is skipped (SCHEMA_TOO_LARGE). A kind whose wrapped command or service is not registered is skipped (MECHANISM_UNAVAILABLE); invalid declarations are MISSING_DECLARATION.

Generated tool names can be listed in mcp-server.disabledTools (@haneinfo/settings): they leave tools/list and calls answer tool_unavailable. tools/list only shows tools whose scopes and authorization the caller holds.

Diagnostics

GET /mcp-generated-tools (interactive login, permission mcp-generated-tools:tools:read) returns { generatedAt, refreshSeconds, maxMachines, maxSchemaBytes, tools, skipped, lastError }. Each tool lists name, kind, machineCode, machineVersion, subjectVersion, schemaVersion, wraps, requiredScopes, schemaBytes and warnings; each skip lists machineCode, kind, name, reason and message. Missing permission is 403 FORBIDDEN.

Installation

// haneinfo.plugins.json: { "plugin": "@haneinfo/mcp-generated-tools", "configRef": "mcpGeneratedTools", ... }
runtime: { mcpGeneratedTools: { refreshSeconds: 60, maxMachines: 20, maxSchemaBytes: 32768, maxNameLength: 32 } }

// App CommandRegistry registration, before commands.seal() and after the hand-written
// list-view, search and instance-analytics commands:
this.generated.registerInto(commands, { scopeNamespace: SCOPE_NAMESPACE });

Requires plugin-api 1.25, commands 0.1, mcp-server 4.0, state-machine 0.23 and list-view 0.9. No tables, no migration and no secrets. Grant mcp-generated-tools:tools:read only to administrators.

| Config | Default | Meaning | | --- | --- | --- | | refreshSeconds | 60 | 0–86,400; recompute at most once per interval (0: every request) | | maxMachines | 20 | 1–200 opted-in machines, by code | | maxSchemaBytes | 32768 | 1,024–1,048,576 bytes of one serialized input schema | | maxNameLength | 32 | 1–32 characters of the name fragment |

Localized labels (draft 202610-a8d3)

Generated descriptions resolve state, field and option labels in the default locale (zh-TW), still as quoted user content. get_<name> adds stateLabel ($userContent) and stateTone. Requires plugin API 1.26.0.