Choose an access method
Connectors are one option, not a Mini App prerequisite, and a missing Connector doesn’t mean the data is unreachable. If the user names a method and it can be verified, use it; otherwise choose by available capabilities, authentication, runtime environment, and the operations you need.
Verify before you build
Before writing the package, run one read-only query against each data source with the chosen method. Confirm authorization, real parameters, response fields and types, and get a representative record or a real empty result. Write the parser from the shape you observed.A query that succeeds in the Agent’s terminal doesn’t prove it works in the Mini App runtime. CLI, API, and file access still need one real run inside the Node service.
Unified tool entry
See Node tool API reference for signatures, inventory and result types, cancellation, and timeouts. Page-side authorization is covered in tool.request reference.The Node service usescontext.tool to list and call the host’s mounted MCP tools and the user’s connected Connector providers. Agent built-in file, shell, and browser tools are not included. For managed MCP implemented by this Mini App, reuse your local business functions directly.miniapp/miniapp.json
context.capabilities?.has('tool') checks whether the host implements the interface, not whether the manifest declared it or the user allows calls. Switching tool access off leaves context.tool present, but new calls reject with TOOL_NOT_PERMITTED.- Take
namefromlist(), matchingkind,server/provider, andtool; never construct tool names.list()returns{ tools, partial };partial: truemeans the inventory is incomplete: a source may be unavailable or some tools may have been omitted because of metadata problems. Listed tools remain callable subject to current permissions. permissionis the currentallow,ask, ordenydecision; every call is judged again. Rules come from the user’s global tool permissions and permission mode, not a particular Agent or session. Host built-in tools retain their existing allowance, and Agent tool hooks do not run on this path.- When confirmation is needed, the host prompts with Allow once, Always allow, and Deny. Only the user’s Always allow choice in that host prompt writes a global rule; the Mini App cannot answer it. When nobody can confirm, the call rejects with
TOOL_APPROVAL_REQUIRED. - MCP results contain
kind: 'mcp',isError, andcontent;isError: trueis a business failure reported by the tool, and the promise still resolves. Connector results containkind: 'connector'and the rawvalue. Reconcile business state before retrying writes afterunknown_after_dispatch. - Node’s
context.tool.request(names)and the page’swindow.mcode.miniapp.tool.request(names)can ask for permission ahead of a call; feature-detecttool.request. A page request must come from a user gesture, name at most 10 tools, and have the Node service running. The page only requests permission; listing and calling stay in Node. Pass runtime names from Node to the page through your business API.
Host Connector
See Host Connector API reference for the completelist, call, tool metadata, and error contracts.The Node service uses connectors the user has authorized through context.hostConnector. Third-party calls use the account the user authorized in MiniMax Code; the Mini App stores no credentials.miniapp/miniapp.json
- Declare only providers the runtime really needs and that you have verified.
list()is always available and returns the allowed tools with their input schemas. Usecall()only after the service is activated, from a request handler, never instart.- Don’t construct or store
toolRefvalues, and don’t send them to the page. List again after a process restart or a stale reference. - When the user signs out, the tool list and authorized references are revoked. After the same account signs in again, call
list()once more to recover, with no republish. If a different account signs in, old references are revoked for good.
Error handling
Branch oncode; don’t rely on instanceof across processes.disposition tells you whether the request went out: not_dispatched, provider_reported, or unknown_after_dispatch. For unknown_after_dispatch, read the business state to reconcile before deciding whether to retry a write.Decoding results
result.value is the third-party service’s raw result; the host doesn’t normalize it. The Skill’s host-connector-value.mjs unwraps the common single-text-block envelope and passes every other shape through unchanged. Zero parsed items count as success only when the service explicitly returned an empty result; if there is source data but nothing parses, treat it as a parse error, not as “no data”.State and persistence
- Keep runtime data in
context.dataDir, not in the workspace or the payload. - Route every write from the page, MCP calls, and Agent operations through one Node business service. Commit state before pushing SSE or WebSocket events so every open page refreshes to the latest data.
context.dataDir as it changes; do not use dispose() as the only persistence point. On restart, read the saved data and resume work.