> ## Documentation Index
> Fetch the complete documentation index at: https://docs.hitheo.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# 自定義工具執行

> 通過內聯工具將 Theo 連接到你產品的操作。

在任意補全請求中傳入工具定義，即可讓 Theo 調用你產品的操作：

```typescript theme={null}
const res = await theo.complete({
  prompt: "Check if we're low on SKU-A1234 and reorder if needed",
  tools: [
    {
      name: "check_inventory",
      description: "Look up current stock levels for a SKU",
      input_schema: {
        type: "object",
        properties: { sku: { type: "string" } },
        required: ["sku"],
      },
    },
    {
      name: "create_reorder",
      description: "Create a purchase order to restock",
      input_schema: {
        type: "object",
        properties: {
          sku: { type: "string" },
          quantity: { type: "number" },
        },
        required: ["sku", "quantity"],
      },
    },
  ],
});

console.log(res.tools_used);
// [{ name: "check_inventory", status: "success" }, { name: "create_reorder", status: "success" }]
```

模型會根據你提供的描述，自行判斷何時調用每個工具。


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.