ツールAPI
ツールAPIは、Mastraプラットフォームで利用可能なツールを操作および実行するためのメソッドを提供します。
Mastraクライアントの初期化
import { MastraClient } from "@mastra/client-js";
const client = new MastraClient();
すべてのツールの取得
利用可能なすべてのツールのリストを取得します:
const tools = await client.getTools();
特定のツールの操作
特定のツールのインスタンスを取得する:
const tool = client.getTool("tool-id");
ツールメソッド
ツールの詳細を取得する
ツールに関する詳細情報を取得します:
const details = await tool.details();
ツールを実行する
特定の引数でツールを実行します:
const result = await tool.execute({
args: {
param1: "value1",
param2: "value2",
},
threadId: "thread-1", // オプション:スレッドコンテキスト
resourceid: "resource-1", // オプション:リソース識別子
});