Skip to main content

What is a Tool?

A tool is a Python class that:
  • Lives in server/tools/<widget>_tool.py
  • Extends BaseWidget
  • Defines inputs with Pydantic
  • Implements widget logic in execute()

Core Concepts

BaseWidget

BaseWidget is the abstract base class that all FastApps widgets must inherit from. It handles all the MCP (Model Context Protocol) wiring and widget lifecycle management automatically.

Required Class Attributes

Optional Class Attributes

Basic Tool Structure

Common Patterns

Simple Data Display

User Input Collection

Conditional Logic

Input Validation

Use Pydantic models to define and validate inputs:

Error Handling

Handle errors gracefully and provide meaningful feedback:

Next Steps

MCP Integration

Integrate external MCP servers using Metorial

API Integration

Connect to external APIs