npx skills add https://github.com/vapiai/skills --skill create-tool创建工具,让语音助手能够在通话过程中执行操作——查询数据、预约、转接电话、发送消息等。
设置: 确保已设置
VAPI_API_KEY。如有需要,请参考setup-api-key技能。
curl -X POST https://api.vapi.ai/tool \
-H "Authorization: Bearer $VAPI_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"type": "function",
"function": {
"name": "get_weather",
"description": "Get current weather for a location",
"parameters": {
"type": "object",
"properties": {
"location": {
"type": "string",
"description": "City name, e.g. San Francisco"
}
},
"required": ["location"]
}
},
"server": {
"url": "https://your-server.com/api/tools"
}
}'
import { VapiClient } from "@vapi-ai/server-sdk";
const vapi = new VapiClient({ token: process.env.VAPI_API_KEY! });
const tool = await vapi.tools.create({
type: "function",
function: {
name: "get_weather",
description: "Get current weather for a location",
parameters: {
type: "object",
properties: {
location: {
type: "string",
description: "City name, e.g. San Francisco",
},
},
required: ["location"],
},
},
server: {
url: "https://your-server.com/api/tools",
},
});
console.log("Tool created:", tool.id);
广告位招租
在这里展示您的产品或服务
触达数万 AI 开发者,精准高效
最常见的工具类型。您的服务器接收函数调用并返回结果。
{
"type": "function",
"function": {
"name": "lookup_order",
"description": "Look up order status by order number",
"parameters": {
"type": "object",
"properties": {
"orderNumber": {
"type": "string",
"description": "The order number to look up"
}
},
"required": ["orderNumber"]
}
},
"server": {
"url": "https://your-server.com/api/tools"
},
"messages": [
{
"type": "request-start",
"content": "Let me look that up for you..."
},
{
"type": "request-complete",
"content": "I found your order information."
},
{
"type": "request-failed",
"content": "I'm having trouble looking that up. Let me try again."
}
]
}
将来电转接到另一个号码或 SIP 端点。
{
"type": "transferCall",
"destinations": [
{
"type": "number",
"number": "+1234567890",
"message": "Transferring you to our billing department now.",
"description": "Transfer to billing department when customer has billing questions"
}
],
"function": {
"name": "transfer_to_billing",
"description": "Transfer the caller to the billing department"
}
}
SIP 转接:
{
"type": "transferCall",
"destinations": [
{
"type": "sip",
"sipUri": "sip:billing@company.com",
"description": "Transfer to billing via SIP"
}
]
}
允许助手以编程方式结束通话。
{
"type": "endCall",
"function": {
"name": "end_call",
"description": "End the call when the conversation is complete"
}
}
在通话期间发送 DTMF 音(按键音信号),用于 IVR 导航。
{
"type": "dtmf",
"function": {
"name": "press_digits",
"description": "Press phone keypad digits to navigate phone menus",
"parameters": {
"type": "object",
"properties": {
"digits": {
"type": "string",
"description": "Digits to press (0-9, *, #)"
}
},
"required": ["digits"]
}
}
}
检测和处理语音信箱。
{
"type": "voicemail",
"function": {
"name": "leave_voicemail",
"description": "Leave a voicemail message"
}
}
{
"type": "google.calendar.event.create",
"function": {
"name": "create_calendar_event",
"description": "Schedule a meeting on Google Calendar"
}
}
{
"type": "google.sheets.row.append",
"function": {
"name": "log_to_sheet",
"description": "Log call data to a Google Sheet"
}
}
{
"type": "slack.message.send",
"function": {
"name": "notify_slack",
"description": "Send a notification to Slack"
}
}
连接到模型上下文协议服务器。
{
"type": "mcp",
"server": {
"url": "https://your-mcp-server.com"
}
}
当助手调用工具时,Vapi 会向您的服务器 URL 发送 POST 请求。
{
"message": {
"type": "tool-calls",
"toolCallList": [
{
"id": "call_abc123",
"name": "get_weather",
"arguments": {
"location": "San Francisco"
}
}
],
"call": {
"id": "call-uuid",
"orgId": "org-uuid",
"type": "webCall"
}
}
}
您的服务器必须返回:
{
"results": [
{
"toolCallId": "call_abc123",
"result": "San Francisco: 65°F, partly cloudy"
}
]
}
import express from "express";
const app = express();
app.use(express.json());
app.post("/api/tools", async (req, res) => {
const { message } = req.body;
const results = [];
for (const toolCall of message.toolCallList) {
let result: string;
switch (toolCall.name) {
case "get_weather":
const weather = await fetchWeather(toolCall.arguments.location);
result = `${toolCall.arguments.location}: ${weather.temp}°F, ${weather.condition}`;
break;
case "lookup_order":
const order = await lookupOrder(toolCall.arguments.orderNumber);
result = `Order ${order.number}: ${order.status}`;
break;
default:
result = "Unknown tool";
}
results.push({ toolCallId: toolCall.id, result });
}
res.json({ results });
});
app.listen(3000);
curl -X PATCH https://api.vapi.ai/assistant/{assistant-id} \
-H "Authorization: Bearer $VAPI_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": {
"provider": "openai",
"model": "gpt-4.1",
"toolIds": ["tool-id-1", "tool-id-2"],
"messages": [{"role": "system", "content": "Your prompt here"}]
}
}'
直接在助手的模型配置中定义工具——请参阅 create-assistant 技能。
# 列出所有工具
curl https://api.vapi.ai/tool -H "Authorization: Bearer $VAPI_API_KEY"
# 获取一个工具
curl https://api.vapi.ai/tool/{id} -H "Authorization: Bearer $VAPI_API_KEY"
# 更新一个工具
curl -X PATCH https://api.vapi.ai/tool/{id} \
-H "Authorization: Bearer $VAPI_API_KEY" \
-H "Content-Type: application/json" \
-d '{"function": {"description": "Updated description"}}'
# 删除一个工具
curl -X DELETE https://api.vapi.ai/tool/{id} \
-H "Authorization: Bearer $VAPI_API_KEY"
对于长时间运行的操作,将工具标记为异步。助手在工具执行期间继续说话:
{
"type": "function",
"async": true,
"function": {
"name": "send_email",
"description": "Send a confirmation email (runs in background)"
},
"server": {
"url": "https://your-server.com/api/tools"
}
}
控制助手在工具执行期间说的话:
{
"messages": [
{
"type": "request-start",
"content": "One moment while I look that up..."
},
{
"type": "request-complete",
"content": "Got it!"
},
{
"type": "request-failed",
"content": "Sorry, I couldn't complete that action."
},
{
"type": "request-response-delayed",
"content": "This is taking a bit longer than usual, please hold.",
"timingMilliseconds": 5000
}
]
}
此技能仓库包含一个 Vapi 文档 MCP 服务器 (vapi-docs),它使您的 AI 代理能够访问完整的 Vapi 知识库。使用 searchDocs 工具查找超出此技能范围的内容——高级配置、故障排除、SDK 详细信息等。
自动配置: 如果您克隆或安装了这些技能,MCP 服务器已通过 .mcp.json (Claude Code)、.cursor/mcp.json (Cursor) 或 .vscode/mcp.json (VS Code Copilot) 自动配置。
手动设置: 如果您的代理未自动检测到配置,请运行:
claude mcp add vapi-docs -- npx -y mcp-remote https://docs.vapi.ai/_mcp/server
请参阅 README 以获取所有支持的代理的完整设置说明。
每周安装数
286
仓库
GitHub 星标数
22
首次出现
2026年2月19日
安全审计
安装于
cursor255
kimi-cli252
gemini-cli252
opencode252
codex252
amp252
Create tools that give voice assistants the ability to take actions during calls — look up data, book appointments, transfer calls, send messages, and more.
Setup: Ensure
VAPI_API_KEYis set. See thesetup-api-keyskill if needed.
curl -X POST https://api.vapi.ai/tool \
-H "Authorization: Bearer $VAPI_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"type": "function",
"function": {
"name": "get_weather",
"description": "Get current weather for a location",
"parameters": {
"type": "object",
"properties": {
"location": {
"type": "string",
"description": "City name, e.g. San Francisco"
}
},
"required": ["location"]
}
},
"server": {
"url": "https://your-server.com/api/tools"
}
}'
import { VapiClient } from "@vapi-ai/server-sdk";
const vapi = new VapiClient({ token: process.env.VAPI_API_KEY! });
const tool = await vapi.tools.create({
type: "function",
function: {
name: "get_weather",
description: "Get current weather for a location",
parameters: {
type: "object",
properties: {
location: {
type: "string",
description: "City name, e.g. San Francisco",
},
},
required: ["location"],
},
},
server: {
url: "https://your-server.com/api/tools",
},
});
console.log("Tool created:", tool.id);
The most common tool type. Your server receives the function call and returns a result.
{
"type": "function",
"function": {
"name": "lookup_order",
"description": "Look up order status by order number",
"parameters": {
"type": "object",
"properties": {
"orderNumber": {
"type": "string",
"description": "The order number to look up"
}
},
"required": ["orderNumber"]
}
},
"server": {
"url": "https://your-server.com/api/tools"
},
"messages": [
{
"type": "request-start",
"content": "Let me look that up for you..."
},
{
"type": "request-complete",
"content": "I found your order information."
},
{
"type": "request-failed",
"content": "I'm having trouble looking that up. Let me try again."
}
]
}
Transfer the caller to another number or SIP endpoint.
{
"type": "transferCall",
"destinations": [
{
"type": "number",
"number": "+1234567890",
"message": "Transferring you to our billing department now.",
"description": "Transfer to billing department when customer has billing questions"
}
],
"function": {
"name": "transfer_to_billing",
"description": "Transfer the caller to the billing department"
}
}
SIP transfer:
{
"type": "transferCall",
"destinations": [
{
"type": "sip",
"sipUri": "sip:billing@company.com",
"description": "Transfer to billing via SIP"
}
]
}
Allows the assistant to end the call programmatically.
{
"type": "endCall",
"function": {
"name": "end_call",
"description": "End the call when the conversation is complete"
}
}
Send DTMF tones (touch-tone signals) during a call for IVR navigation.
{
"type": "dtmf",
"function": {
"name": "press_digits",
"description": "Press phone keypad digits to navigate phone menus",
"parameters": {
"type": "object",
"properties": {
"digits": {
"type": "string",
"description": "Digits to press (0-9, *, #)"
}
},
"required": ["digits"]
}
}
}
Detect and handle voicemail.
{
"type": "voicemail",
"function": {
"name": "leave_voicemail",
"description": "Leave a voicemail message"
}
}
{
"type": "google.calendar.event.create",
"function": {
"name": "create_calendar_event",
"description": "Schedule a meeting on Google Calendar"
}
}
{
"type": "google.sheets.row.append",
"function": {
"name": "log_to_sheet",
"description": "Log call data to a Google Sheet"
}
}
{
"type": "slack.message.send",
"function": {
"name": "notify_slack",
"description": "Send a notification to Slack"
}
}
Connect to Model Context Protocol servers.
{
"type": "mcp",
"server": {
"url": "https://your-mcp-server.com"
}
}
When the assistant calls a tool, Vapi sends a POST request to your server URL.
{
"message": {
"type": "tool-calls",
"toolCallList": [
{
"id": "call_abc123",
"name": "get_weather",
"arguments": {
"location": "San Francisco"
}
}
],
"call": {
"id": "call-uuid",
"orgId": "org-uuid",
"type": "webCall"
}
}
}
Your server must return:
{
"results": [
{
"toolCallId": "call_abc123",
"result": "San Francisco: 65°F, partly cloudy"
}
]
}
import express from "express";
const app = express();
app.use(express.json());
app.post("/api/tools", async (req, res) => {
const { message } = req.body;
const results = [];
for (const toolCall of message.toolCallList) {
let result: string;
switch (toolCall.name) {
case "get_weather":
const weather = await fetchWeather(toolCall.arguments.location);
result = `${toolCall.arguments.location}: ${weather.temp}°F, ${weather.condition}`;
break;
case "lookup_order":
const order = await lookupOrder(toolCall.arguments.orderNumber);
result = `Order ${order.number}: ${order.status}`;
break;
default:
result = "Unknown tool";
}
results.push({ toolCallId: toolCall.id, result });
}
res.json({ results });
});
app.listen(3000);
curl -X PATCH https://api.vapi.ai/assistant/{assistant-id} \
-H "Authorization: Bearer $VAPI_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": {
"provider": "openai",
"model": "gpt-4.1",
"toolIds": ["tool-id-1", "tool-id-2"],
"messages": [{"role": "system", "content": "Your prompt here"}]
}
}'
Define tools directly in the assistant's model configuration — see the create-assistant skill.
# List all tools
curl https://api.vapi.ai/tool -H "Authorization: Bearer $VAPI_API_KEY"
# Get a tool
curl https://api.vapi.ai/tool/{id} -H "Authorization: Bearer $VAPI_API_KEY"
# Update a tool
curl -X PATCH https://api.vapi.ai/tool/{id} \
-H "Authorization: Bearer $VAPI_API_KEY" \
-H "Content-Type: application/json" \
-d '{"function": {"description": "Updated description"}}'
# Delete a tool
curl -X DELETE https://api.vapi.ai/tool/{id} \
-H "Authorization: Bearer $VAPI_API_KEY"
For long-running operations, mark a tool as async. The assistant continues speaking while the tool executes:
{
"type": "function",
"async": true,
"function": {
"name": "send_email",
"description": "Send a confirmation email (runs in background)"
},
"server": {
"url": "https://your-server.com/api/tools"
}
}
Control what the assistant says during tool execution:
{
"messages": [
{
"type": "request-start",
"content": "One moment while I look that up..."
},
{
"type": "request-complete",
"content": "Got it!"
},
{
"type": "request-failed",
"content": "Sorry, I couldn't complete that action."
},
{
"type": "request-response-delayed",
"content": "This is taking a bit longer than usual, please hold.",
"timingMilliseconds": 5000
}
]
}
This skills repository includes a Vapi documentation MCP server (vapi-docs) that gives your AI agent access to the full Vapi knowledge base. Use the searchDocs tool to look up anything beyond what this skill covers — advanced configuration, troubleshooting, SDK details, and more.
Auto-configured: If you cloned or installed these skills, the MCP server is already configured via .mcp.json (Claude Code), .cursor/mcp.json (Cursor), or .vscode/mcp.json (VS Code Copilot).
Manual setup: If your agent doesn't auto-detect the config, run:
claude mcp add vapi-docs -- npx -y mcp-remote https://docs.vapi.ai/_mcp/server
See the README for full setup instructions across all supported agents.
Weekly Installs
286
Repository
GitHub Stars
22
First Seen
Feb 19, 2026
Security Audits
Gen Agent Trust HubFailSocketPassSnykPass
Installed on
cursor255
kimi-cli252
gemini-cli252
opencode252
codex252
amp252
AI Elements:基于shadcn/ui的AI原生应用组件库,快速构建对话界面
56,200 周安装