You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
import type { ApiBasedTool } from "./apiBasedTools.js";
const fetchToolSchemaSchema = z.object({
toolName: z
.string()
.describe("Name of the API-based tool to load, for example get_resource."),
});
export async function createFetchToolSchemaTool(
apiBasedTools: Record<string, ApiBasedTool>,
) {
return tool(
async ({ toolName }) => {
const toolDefinition = apiBasedTools[toolName];
if (!toolDefinition) {
return JSON.stringify(
{
status: 404,
error: "TOOL_NOT_FOUND",
message: `Tool "${toolName}" not found.`,
},
null,
2,
);
}
return JSON.stringify(
{
status: 200,
name: toolName,
loaded: true,
},
null,
2,
);
},
{
name: "fetch_tool_schema",
description:
"Fetch the schema for an API-based AdminForth tool by name and load it for later use. Use this right after fetch_skill when the skill mentions non-base tools.",