| .. | ||
| compilation.md | ||
| external-apis.md | ||
| get-integration.md | ||
| llm-rest-server.md | ||
| mcp-format.md | ||
| nvidia-gpu-setup.md | ||
| openai-format.md | ||
| param-declaration.md | ||
| README.md | ||
| tool-definition.md | ||
Chapter 09: API and Tooling
Define tools that LLMs can call from your BASIC scripts.
Overview
Tools are BASIC scripts with PARAM declarations that become callable functions for the LLM. This enables AI-driven automation with structured inputs.
Tool Structure
' weather.bas - A tool the LLM can invoke
PARAM city AS STRING LIKE "London" DESCRIPTION "City name"
PARAM units AS STRING LIKE "celsius" DESCRIPTION "Temperature units"
DESCRIPTION "Gets current weather for a city"
data = GET "api.weather.com/current?city=" + city
TALK "Weather in " + city + ": " + data.temperature + "°"
How It Works
- PARAM declarations define inputs
- DESCRIPTION explains the tool's purpose
- LLM decides when to call the tool
- Parameters collected through conversation
- Tool executes with validated inputs
PARAM Declaration
PARAM name AS type LIKE "example" DESCRIPTION "explanation"
| Component | Purpose |
|---|---|
name |
Variable name |
type |
STRING, INTEGER, DATE, etc. |
LIKE |
Example value for LLM |
DESCRIPTION |
What this parameter is for |
Tool Formats
Tools compile to multiple formats:
| Format | Use Case |
|---|---|
| MCP | Model Context Protocol |
| OpenAI | Function calling |
| Internal | BASIC runtime |
Chapter Contents
- Tool Definition - Creating tools
- PARAM Declaration - Parameter syntax
- Tool Compilation - Build process
- MCP Format - MCP integration
- OpenAI Format - Function calling
- GET Integration - API calls
- External APIs - Third-party services
- LLM REST Server - Hosting models
- NVIDIA GPU Setup - GPU acceleration
See Also
- BASIC Dialogs - Scripting reference
- REST API - HTTP endpoints