🎁 Get the FREE AI Skills Starter GuideSubscribe →
BytesAgainBytesAgain
🦀 ClawHub

OpenClaw LLM Tools

by @michealxie001

Universal Tool Definition System for LLM function calling. Define tools once, use with any LLM provider (OpenAI, Anthropic, Gemini, etc.). JSON Schema valida...

When to Use
TriggerAction
2. **工具共享** - 在 Skills 间共享工具定义
3. **参数验证** - 自动验证 LLM 输出的参数
4. **格式转换** - 迁移到不同 LLM 提供商
💡 Examples

1. 定义工具

from llm_tools import ToolRegistry, Tool

创建工具注册表

registry = ToolRegistry()

定义工具

@registry.register( name="get_weather", description="Get current weather for a location", parameters={ "type": "object", "properties": { "location": { "type": "string", "description": "City name" }, "unit": { "type": "string", "enum": ["celsius", "fahrenheit"], "default": "celsius" } }, "required": ["location"] } ) def get_weather(location: str, unit: str = "celsius"): return {"temperature": 22, "unit": unit}

2. 转换为不同 LLM 格式

# OpenAI format
openai_tools = registry.to_openai()

Anthropic format

anthropic_tools = registry.to_anthropic()

Google Gemini format

gemini_tools = registry.to_gemini()

Ollama format

ollama_tools = registry.to_ollama()

3. 验证工具调用

# 验证参数
is_valid, error = registry.validate_call(
    "get_weather",
    {"location": "Beijing", "unit": "celsius"}
)

执行工具

result = registry.execute("get_weather", {"location": "Beijing"})

View on ClawHub
TERMINAL
clawhub install oc-llm-tools

🧪 Use this skill with your agent

Most visitors already have an agent. Pick your environment, install or copy the workflow, then run the smoke-test prompt above.

🔍 Can't find the right skill?

Search 60,000+ AI agent skills — free, no login needed.

Search Skills →