Skip to main content

Crate pamin_kit

Crate pamin_kit 

Source
Expand description

The framework every Pamin module is built on.

A module is an engine plus an operation contract. The kit serves that contract as MCP and does what every module would otherwise repeat around each call: knowing who is calling, checking what they may use and recording usage.

Re-exports§

pub use schemars;

Structs§

App
An HTML page a host renders as an MCP App, served as a resource.
Ask
One question an operation asks the user, as an MCP elicitation: a message and the form of the answer.
BadModuleName
A name ModuleName refused, as given.
Change
A resource that changed, in the space whose call changed it.
Completing
Completes one argument of a prompt or variable of a resource template. What the user has typed so far, for suggesting the rest.
Ctx
What an operation knows about its call besides its arguments.
Hardware
What one instance needs to run.
Hints
What a host may assume about a tool, sent as MCP tool annotations: hints for the host and the user, never guarantees. The defaults are MCP’s: a tool may change things, destructively, not idempotently, and reach beyond the module.
Icon
An icon, by URL or data: URI.
InProcessChanges
The open-source feed: changes reach listeners in this process. Enough for one local server, and for a module routed sharded_by_project, whose project’s writers and listeners share an instance; a feed across instances (PostgreSQL LISTEN, Redis) implements ChangeFeed.
InProcessTasks
The open-source store: tasks held in this process, gone when it exits. Enough for one local server, where a reconnecting client reaches the same process.
Kit
A module ready to serve, with the seams its calls go through.
Local
The open-source identity: one local user working on one project, whatever the request carries.
Looks
How a tool, prompt, resource or the server shows to people: none of it changes what it does.
Manifest
What a module says about itself, so that gateways and hosts never branch on its name.
Message
One message of a prompt.
ModuleName
A module’s name: a lowercase ASCII letter, then lowercase ASCII letters and digits. Its tools, prompts, resources and app pages are named after it, and the conformance suite holds a module to it; a host reading a manifest back parses its name into this, so the rule is written once.
NeedsInput
What Ctx::ask returns while the user has not answered yet: return it (with ?) from the operation, and the kit asks the client, which calls the operation again with the answer.
Open
The open-source entitlements: every core feature, no paid one.
Ops
The operations a module registers.
Prompt
A prompt a module offers: messages a user picks to start a conversation with, filled from arguments.
PromptArgument
One argument of a prompt, from a field of its arguments type.
Reply
What a tool returned: its structured result and any content beside it.
Resource
A resource a module serves: data a host or model reads by URI. With {name} variables in its URI it is a template, read at any URI that matches.
Space
Who a call is for and what it works on. It comes only from the caller’s identity, never from tool arguments.
StoredTask
One task, as stored. Serializable so a store can keep it as JSON.
Tool
An operation as callers see it.
Unmetered
The open-source metering: records nothing.
Usage
One call, as metering sees it.

Enums§

Audience
Who a module’s tools are for.
Body
What reading a resource returns.
CallError
Why a call returned no result.
Content
Content beside a tool’s structured result, or a prompt message: what MCP calls content blocks.
Feature
What an operation needs the caller to be entitled to.
Form
How the user answers a question.
Role
Who says a prompt message, or who a resource is for.
Routing
How a gateway spreads calls over instances.
TaskState

Constants§

TASK_TTL
How long a store keeps a task after its last update, at least. Callers are told this, so they know how long they may come back for a result.

Traits§

ChangeFeed
Carries resource changes from the calls that make them to the clients listening for them (subscriptions/listen). Used when a call changes a resource and when a listener starts, never on the call path otherwise.
Entitlements
Decides whether a space may use a feature.
Identity
Resolves a request to the space it works on.
Metering
Records what each call used.
Module
A module: an engine plus its operation contract, served by the kit.
TaskStore
Keeps task state between the call that started a task and the polls that read it.

Type Aliases§

JsonObject
A JSON object, as tool schemas and arguments are.