Skip to main content

Module packages

Module packages 

Source
Expand description

Package discovery over the standard library, plus the prelude built-in catalog (builtins / builtin_docs).

In MVP the resolvable set is the stdlib — there is no registry yet. Each module’s exported declarations render to .d.subm-style text directly from its PackageDeclaration (the public symbol model). Shared by the MCP packages.* / builtins.docs tools, the server’s REST surface, and the submilli docs / search / builtins CLI commands.

Structs§

Builtins
The language built-ins always in scope without an import: headline prelude types (Array, Map, String, …) and the namespace globals (Math, Temporal, and the JSON compiler intrinsic). Backs the {builtins} prompt placeholder and the builtins.docs tool.
Catalog
A bounded available-package listing.
CatalogEntry
A summary-only entry in the “here is what exists” listing a zero-hit discovery response carries. Never declarations — this is a pointer, not a payload.
ModuleDoc
A module’s full documentation: its one-line description and .d.subm declarations.
ModuleSummary
A search result — name + one-line description.

Enums§

BuiltinLookup
Why resolving a built-in name succeeded or failed. The distinction matters to callers: an unresolvable member can name the members that do exist, which turns a dead end into a one-edit repair.
Resolution
How a discovery surface should answer one name, once the stdlib and built-in catalogs have both been consulted.

Constants§

CATALOG_LIMIT
Upper bound on listed entries; the remainder is reported as a count.
SOURCE_STDLIB
Source tag for the stdlib modules this crate can see.

Functions§

builtin_docs
.d.subm declarations for a single built-in (Array, Temporal, JSON, …), or None if name isn’t one. Accepts a dotted member path (Temporal.Instant) as well as a plain name — see builtin_lookup.
builtin_lookup
Resolve a built-in name, which may be a dotted path into a namespace (Temporal.Instant, Temporal.Now.instant, Math.max, Array.isArray).
builtin_no_import_note
Prose to accompany a built-in served through a package-shaped surface. A source tag is a machine field; an agent reading the message still has to be told not to write an import.
builtins
The catalog of built-ins an agent can reference — see Builtins.
builtins_pointer
Where the language globals live. A zero-hit package search says this rather than folding built-ins into its results, which would teach an agent to write an import for a global.
catalog
The stdlib catalog plus whatever extra sources the caller can see, capped.
catalog_filtered
Filter before applying the catalog limit so omitted counts reflect visibility.
docs
Documentation for a stdlib module, or None if name isn’t one (callers handle @mcp/* and unknown names). Every module resolves, opt-in ones such as submilli:git included; what a caller’s scope shows is its own decision.
package_correcting_message
A package name asked of a built-ins surface. The forgiveness here is asymmetric on purpose: a built-in asked of packages.docs is simply served, because it needs no import, while a package needs an import the caller still has to write — so this names the call to make rather than hiding that step behind the declarations.
render_declarations
Render a module’s exports as .d.subm-style declarations. Public so an embedder can render dynamically-built packages (e.g. @mcp/<server>) the same way the stdlib docs render.
render_lib_submilli_d_ts
Render editor-facing TypeScript ambient declarations for always-in-scope built-ins.
render_packages_d_ts
Render editor-facing TypeScript declarations for packages, one declare module block each, in the order given.
render_stdlib_d_ts
Render editor-facing TypeScript declarations for every stdlib module a package project can import. Each package gets a separate declare module block. submilli:test is included even though only build test makes it importable, and submilli:security even though only packages may import it — the editor should complete both; build check remains the gate against importing them elsewhere.
resolve
Try name as a stdlib module, then as a built-in. Every discovery surface runs this same ladder so MCP, REST, and the CLI reach the same answer.
search
Modules whose name, description, or an exported symbol contains query (case-insensitive). An empty query lists every module.
suggest
suggest_filtered
Suggest only names visible to the caller, retaining built-in corrections.
unknown_member_message
Name the head, then list what it actually has, so the repair is one edit.