Basic Tool
Here’s a simple tool that searches documents. Notice the type annotations and docstring—these are essential for LLMs to understand and use your tool correctly.Requirements
Every tool needs a few things to work properly with Gumstack and LLMs. Missing any of these will cause issues.Declare in config.yaml
Every tool must be declared inconfig.yaml:
name must match your function name exactly. Without this, Gumstack won’t detect the tool.
Return type annotation
Every tool must have a return type. This generates the output schema that Gumloop uses for node connections.Docstrings
LLMs use docstrings to decide when to call your tool. Be specific:Parameter descriptions
UseAnnotated with a string or Field(description=...):
Supported types
FastMCP supports all Pydantic types:| Type | Example |
|---|---|
| Basic | int, float, str, bool |
| Collections | list[str], dict[str, int] |
| Optional | str | None, Optional[str] |
| Constrained | Literal["A", "B"], Enum |
| Pydantic models | User, SearchResult |
| Date/time | datetime, date |
| Paths | Path |
Common Mistakes
These patterns cause problems in production. Avoid them to keep your tools reliable and debuggable.Bare dict returns
Bare dict returns
Blocking I/O in async
Blocking I/O in async
Hardcoded credentials
Hardcoded credentials
Swallowing exceptions
Swallowing exceptions
One Tool, One Job
Resist the urge to create “swiss army knife” tools that do multiple things. Split complex operations into focused tools for better:- Observability — See exactly which operation failed
- Access control — Admins can restrict specific actions
- LLM accuracy — Simpler tools are easier to use correctly
Low-level Server API
FastMCP handles most use cases, but if you need fine-grained control over tool registration and responses, you can use the low-levelServer class directly:
