Project Files
src / tools-provider.ts
import { createGitBranchTool } from "./tools/git-branch-tool"
import { createGitCloneTool } from "./tools/git-clone-tool"
import { createGitDiffTool } from "./tools/git-diff-tool"
import { createGitGrepTool } from "./tools/git-grep-tool"
import { createGitLogTool } from "./tools/git-log-tool"
import { createGitLsFilesTool } from "./tools/git-ls-files-tool"
import { createGitShowTool } from "./tools/git-show-tool"
import { createGitStatusTool } from "./tools/git-status-tool"
import type { Tool, ToolsProviderController } from "@lmstudio/sdk"
/**
* Register the plugin's git tools with the LM Studio SDK controller.
*
* The controller is forwarded to each tool factory so the working directory can be read lazily
* inside `implementation` (the SDK only attaches a working directory once a tool is actually
* invoked from a chat).
*
* @param ctl Tools provider controller supplied by the LM Studio SDK.
* @returns The registered git tools.
*/
export async function gitToolsProvider(ctl: ToolsProviderController): Promise<Tool[]> {
return [
createGitStatusTool(ctl),
createGitDiffTool(ctl),
createGitLogTool(ctl),
createGitBranchTool(ctl),
createGitShowTool(ctl),
createGitLsFilesTool(ctl),
createGitGrepTool(ctl),
createGitCloneTool(ctl),
]
}