MES architecture

How MESkit agents call MES tools

Technical deep dive into tool registration, call chains, and event-driven quality analysis.

Summary

2-4 sentence snapshot for quick retrieval.

Summary

MESkit agents are configured with explicit tool definitions that map to the same typed functions used by UI server actions. A user prompt resolves into deterministic tool calls, then writes to Supabase through validated operations.

From intent to function call

When a user writes a command in chat, the runtime forwards structured context: current mode, selected line, and related IDs when available. Claude tool-use then selects from registered tools and emits a call payload.

The runtime executes the selected tool using schema-validated input. If validation fails, the call is rejected with a clear error, and no state mutation occurs.

Once execution completes, the result is returned to the model for final response generation and to the UI for direct rendering in the conversation timeline.

Tool chain example: scrap a defective unit

A user asks: scrap SMX-00044 due to solder bridge. The runtime resolves this into a sequence: `search_units` to locate the unit, `create_quality_event` to store defect context, then `scrap_unit` to set terminal state.

Because each call is explicit, the audit trail shows exactly what happened and in which order. This is critical for manufacturing QA workflows and post-incident analysis.

The same operations are available in direct UI actions. The difference is only interface, not business logic.

Event-driven analyst flow

Quality Analyst is not prompt-only. It can activate on realtime events when yield drops below threshold, when defect clusters form within a window, or when scrap rates rise unexpectedly.

After activation, it uses read-focused tools like `get_yield_report`, `get_unit_history`, and `search_units`, then publishes a concise alert with likely root causes and suggested checks.

This keeps monitoring proactive while preserving operator control over corrective actions.

Key facts and mini FAQ

Answer-ready end section.

Key facts

  • Tool contracts are typed and validated before execution.
  • Operator Assistant can call all shop-floor and execution tools.
  • Quality Analyst is event-driven and threshold-based.
  • Production Planner is on-demand and analytics-oriented.

Mini FAQ

Do agents have a private API?

No. Agents use the same tool layer as the UI.

Can quality alerts trigger automatically?

Yes. The Quality Analyst listens to realtime conditions and runs when thresholds are breached.

Canonical links

Related supporting pages.