MCP tools and the AI layer
Extend the MCP server and the AI features without breaking determinism or leaking data.
The MCP server exposes OSMAINT to AI clients as tools: whoami, list sites, search equipment, get and list work orders, list alarms, open condition events, list routes, hazards, safety plans, meter groups, create and update work orders, run a route. The tool contract is the product surface for agents.
Adding a tool
- Define the tool with a narrow, explicit input schema.
- Enforce the caller's scopes inside the tool, not only in the client.
- Cap list results and report truncation and total.
- Return structured errors the model can act on.
- Test the tool with a viewer token: it must not mutate.
The AI rule
Every AI feature has a deterministic path. Classification, prioritisation, root-cause suggestions, PM optimisation and report drafting all degrade to a manual choice when no model is available. That is why the AI provider is configuration, not an assumption.
Data boundaries
An AI feature that sends records to an external provider is a data-processing decision, not a UI decision. Self-hosted installations can point the AI layer at a local model, which keeps the data inside the plant. Document which provider is used and what leaves the system.
Never put a secret, a token or a real customer record in a prompt, a test fixture or a documentation example. Placeholders only.
Call one read tool and one write tool with a viewer token. The read must succeed within its scope; the write must fail with a permission error.
Terms
- Tool
- A named function an AI client can call, with a schema and a permission boundary.
- Deterministic fallback
- The non-AI path that keeps the feature working when no model is available.
OSMAINT Academy · Developer · MCP tools and the AI layer · osmaint.org/academy/