tool-calling
3
总安装量
2
周安装量
#58010
全站排名
安装命令
npx skills add https://github.com/pluginagentmarketplace/custom-plugin-ai-agents --skill tool-calling
Agent 安装分布
mcpjam
2
neovate
2
gemini-cli
2
antigravity
2
windsurf
2
zencoder
2
Skill 文档
Tool Calling
Enable LLMs to call functions and interact with external systems.
When to Use This Skill
Invoke this skill when:
- Adding function calling to agents
- Designing tool schemas
- Integrating external APIs
- Implementing validation and error handling
Parameter Schema
| Parameter | Type | Required | Description | Default |
|---|---|---|---|---|
task |
string | Yes | Tool calling goal | – |
provider |
enum | No | anthropic, openai, langchain |
anthropic |
strict_mode |
bool | No | Enable strict validation | true |
Quick Start
Claude Tool Use
from anthropic import Anthropic
tools = [{
"name": "get_weather",
"description": "Get weather for a location",
"input_schema": {
"type": "object",
"properties": {
"location": {"type": "string"}
},
"required": ["location"]
}
}]
response = client.messages.create(
model="claude-sonnet-4-20250514",
tools=tools,
messages=[{"role": "user", "content": "Weather in Tokyo?"}]
)
LangChain Tools
from langchain_core.tools import tool
@tool
def search(query: str) -> str:
"""Search the web for information."""
return web_search(query)
Schema Best Practices
# Good: verb_noun, clear description
{
"name": "search_products",
"description": """Search product database.
USE WHEN: User asks about products.
DO NOT USE: For order status (use get_order instead)."""
}
# Bad: vague
{"name": "helper", "description": "Helps with stuff"}
Troubleshooting
| Issue | Solution |
|---|---|
| Tool not called | Improve description |
| Wrong tool selected | Add “DO NOT USE” conditions |
| Invalid arguments | Enable strict mode |
| Execution timeout | Add timeout, retry logic |
Best Practices
- Use verb_noun naming convention
- Keep tool count under 20
- Include usage examples in descriptions
- Return errors as tool results
Related Skills
ai-agent-basics– Agent loopsllm-integration– API setupagent-safety– Input validation