Documentation Index
Fetch the complete documentation index at: https://lastmileai-94a5811a-server-deployment-docs.mintlify.app/llms.txt
Use this file to discover all available pages before exploring further.
Decorators
MCPApp exposes a small set of decorators that register tools, workflows, and workflow tasks. The decorators are engine-aware: when you switch from the default asyncio executor to Temporal, the same annotations automatically apply the appropriate Temporal SDK wrappers.
| Decorator | Applies to | Purpose |
|---|---|---|
@app.tool | sync function | Exposes a blocking function as an MCP tool. |
@app.async_tool | async function | Registers an async tool and publishes it through FastMCP. |
@app.workflow | Workflow subclass | Declares a workflow class and adapts it for the active execution engine. |
@app.workflow_run | async method | Marks the primary run coroutine for a workflow. |
@app.workflow_task | async function/method | Registers an activity task reusable across workflows. |
@app.workflow_signal | async method | Handles inbound workflow signals (Temporal-friendly). |
Tool decorators
Tools expose code as MCP functions that agents and LLMs can call. Both decorators accept the same keyword arguments:| Parameter | Description |
|---|---|
name | Override the exported MCP tool name (defaults to the function name). |
title | Short display label for clients. |
description | Human-readable description; the function docstring is used when omitted. |
annotations | Supply a ToolAnnotations object or mapping for MCP metadata. |
icons | Provide one or more Icon instances or mappings for client rendering. |
meta | Arbitrary metadata forwarded to FastMCP. |
structured_output | Set to True to hint that the result is structured JSON; some LLMs will choose schema-aware models automatically. |
@app.tool — synchronous tools
- The decorator validates the signature up-front; missing type hints or unsupported default values raise an error during import.
@app.toolautomatically creates a hidden workflow so the tool is reachable via bothcallTooland the workflow endpoints (run,get_status) exposed by FastMCP.- The function executes inside the app event loop; heavy work should offload itself (for example, using
asyncio.to_thread).
@app.async_tool — asynchronous tools
- The coroutine is awaited directly, so you can call other async APIs without wrappers.
- When Temporal is active, the decorated function is wrapped with
workflow.activitymetadata automatically.
Workflow decorator suite
Workflows orchestrate complex sequences, combining tasks, tools, and signals. Every workflow subclass must inherit frommcp_agent.executor.workflow.Workflow.
@app.workflow
- Registers the class with the app and applies engine-specific decorators (
workflow.defnfor Temporal, no-op for asyncio). - An optional
workflow_idparameter lets you export the workflow under a different name when registering. - The decorator stores a reference to the
MCPApp, letting workflow instances accessself.context.app.
@app.workflow_run
Wraps the run coroutine so that initialization, tracing, and Temporal-specific instrumentation are handled automatically. You rarely need to call it manually—applying @app.workflow and naming the method run is enough—but explicit usage lets you decorate additional entry points.
@app.workflow_task
Registers a coroutine as a reusable activity. Key options:
| Option | Effect |
|---|---|
name | Override the fully qualified activity name (defaults to <module>.<qualname>). |
schedule_to_close_timeout | Maximum wall-clock duration allowed for the task. |
retry_policy | Temporal retry configuration (e.g. {"maximum_attempts": 5}). |
**meta_kwargs | Arbitrary metadata stored alongside the task for inspection. |
asyncio.to_thread.
Tasks defined outside a workflow are also supported—they are registered globally and can be reused across multiple workflows.
@app.workflow_signal
Signals let external actors (humans, webhooks, other workflows) nudge a running workflow. The decorator accepts an optional name argument and works in both asyncio and Temporal modes.
self) for Temporal’s signal handler signature.
All workflow decorators defer to the active executor. When you switch to Temporal, tasks become activities,
run becomes a workflow entry point, and signals map to @workflow.signal—no additional changes required.Putting it together
- A reusable
list_serverstool that exposes runtime metadata without boilerplate. - A workflow that can run locally (asyncio) or durably (Temporal) with the same code.
- Optional signals/tasks to pause, resume, or branch as needed.
