MCP tool schemas
Turn each assigned service into one MCP tool with a schema derived from its input and output.
Each service assigned to an MCP gateway becomes one tool, and everything an AI agent learns about it through tools/list comes from the service itself - there is no separate tool definition to write or keep in sync.
| Tool element | Where it comes from |
|---|---|
name | The service's name, e.g. billing.get-invoice |
description | The service's docstring - this is what the agent's model reads when deciding which tool to call, so write docstrings for the model as much as for colleagues |
inputSchema | Generated from the service's declared input |
outputSchema | Generated from the service's declared output |
Input schema generation
Both I/O styles produce the same JSON Schema. With plain declarations, each element maps to its JSON Schema type - Int becomes integer, Bool becomes boolean, Float becomes number, Dict becomes object, List becomes array, Date, DateTime and UUID become strings with their format, and text-like elements become strings:
class GetInvoice(Service):
""" Returns one invoice by its ID, optionally with line items.
"""
input = 'invoice_id', '-include_items'
With dataclass models, each field's Python annotation maps the same way - str, int, float, bool, list[T] with its element type, dict, dates, Decimal, UUID - and nested dataclasses recurse into nested object schemas. A field is required unless it has a default or its type is optional, and required names are listed in the schema's required list. In plain declarations the - prefix marks an element optional.
The generated schema is exactly what argument validation enforces when it is on - the schema agents see and the schema calls are checked against are always the same one.
A service with no declared input produces a schema that accepts any arguments.
Exposed services
- Only services assigned to the gateway appear - the Services picker on the wizard's step 01 lists what can be assigned.
- Internal services - names starting with
zato.orpub.zato.- are never exposed, regardless of the assignment. The picker does not offer them, and the runtime refuses them even if configuration were to name them. - Tools are listed in a deterministic alphabetical order, so clients can cache the list.
Live updates
Hot-deploying a changed service rebuilds the tool list of every gateway that exposes it - the next tools/list already advertises the schemas the redeployed code declares, with no restarts. Editing the gateway itself rebuilds its registry the same way.
The Export document described under sharing a gateway with clients uses the same schema generation.
See also
| Feature | What it does |
|---|---|
| Argument validation | Checks tools/call arguments against the same generated schema |
| Sharing with clients | Exports the tool list with its schemas as one server.json document |
| MCP gateways | Configuration, endpoint behavior and the governance controls |
| Tool selection | Docstrings and schemas that steer agents to the right tool |