src / toolsProvider.ts

import { tool, Tool, ToolsProviderController } from "@lmstudio/sdk";
import { z } from "zod";
import { configSchematics } from "./configSchematics";
import { existsSync } from "fs";
import { writeFile } from "fs/promises";
import { getCreateFileTool } from "./tools/createFile";
import { getWriteFileTool } from "./tools/writeFile";
import { getLsTool } from "./tools/lsTool";
import { getReadFileTool } from "./tools/readFileTool";
import { getPeekFileTool } from "./tools/peekFileTool";

export async function toolsProvider(ctl: ToolsProviderController) {
  const config = ctl.getPluginConfig(configSchematics);

  const tools: Tool[] = [];

  tools.push(getCreateFileTool(ctl));
  tools.push(getWriteFileTool(ctl));
  tools.push(getLsTool(ctl));
  tools.push(getReadFileTool(ctl));
  tools.push(getPeekFileTool(ctl));

  return tools;
}