src / toolsProvider.ts
import { ToolsProviderController } from "@lmstudio/sdk";
import { defaultHttpClient, defaultImageSearchEngine } from "./bootstrap";
import { defaultWebpageCache } from "./cache/WebpageCache";
import { configSchematics } from "./config/configSchematics";
import { defaultConfigurationService } from "./config/ConfigurationService";
import { createInspectImagesTool } from "./tools/inspectImages";
import { getCurrentTimeTool } from "./tools/getCurrentTime";
import { createReadWebpageTool } from "./tools/readWebpage";
import { createSearchImagesTool } from "./tools/searchImages";
import { searchWebTool } from "./tools/searchWeb";
export async function toolsProvider(ctl: ToolsProviderController) {
// Update LMStudioConfigurationSource with active LM Studio UI settings
try {
const pluginConfig = ctl.getGlobalPluginConfig(configSchematics);
defaultConfigurationService.lmStudioSource.setPluginConfig(pluginConfig);
defaultConfigurationService.syncAllProviders();
} catch {
// Fall back to environment configuration source
}
const searchImagesTool = createSearchImagesTool(defaultImageSearchEngine, ctl);
const readWebpageTool = createReadWebpageTool(defaultHttpClient, defaultWebpageCache, ctl);
const inspectImagesTool = createInspectImagesTool(ctl);
return [
searchWebTool,
readWebpageTool,
searchImagesTool,
getCurrentTimeTool,
inspectImagesTool,
];
}
src / toolsProvider.ts
import { ToolsProviderController } from "@lmstudio/sdk";
import { defaultHttpClient, defaultImageSearchEngine } from "./bootstrap";
import { defaultWebpageCache } from "./cache/WebpageCache";
import { configSchematics } from "./config/configSchematics";
import { defaultConfigurationService } from "./config/ConfigurationService";
import { createInspectImagesTool } from "./tools/inspectImages";
import { getCurrentTimeTool } from "./tools/getCurrentTime";
import { createReadWebpageTool } from "./tools/readWebpage";
import { createSearchImagesTool } from "./tools/searchImages";
import { searchWebTool } from "./tools/searchWeb";
export async function toolsProvider(ctl: ToolsProviderController) {
// Update LMStudioConfigurationSource with active LM Studio UI settings
try {
const pluginConfig = ctl.getGlobalPluginConfig(configSchematics);
defaultConfigurationService.lmStudioSource.setPluginConfig(pluginConfig);
defaultConfigurationService.syncAllProviders();
} catch {
// Fall back to environment configuration source
}
const searchImagesTool = createSearchImagesTool(defaultImageSearchEngine, ctl);
const readWebpageTool = createReadWebpageTool(defaultHttpClient, defaultWebpageCache, ctl);
const inspectImagesTool = createInspectImagesTool(ctl);
return [
searchWebTool,
readWebpageTool,
searchImagesTool,
getCurrentTimeTool,
inspectImagesTool,
];
}