load_project
Load a Svelte project by specifying its root directory path. This action restarts the language server to switch between different Svelte projects at runtime.
Instructions
Load a Svelte project by its root directory. Restarts the language server pointed at the new workspace. Call this to switch between projects at runtime.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| path | Yes | Absolute path to the Svelte project root directory |
Implementation Reference
- src/tools/lifecycle.ts:26-39 (handler)The handler function for the 'load_project' tool which resolves the path and calls the LSP client's loadProject method.
async ({ path }): Promise<ToolResult> => { try { const resolved = resolve(path); if (!existsSync(resolved)) { return textResult(`Directory not found: ${resolved}`); } await lsp.loadProject(resolved); return textResult( `Loaded project '${basename(resolved)}'. Language server is indexing - first requests may be slow.` ); } catch (ex) { return textResult(formatError(ex)); } } - src/tools/lifecycle.ts:18-24 (schema)Input schema definition for the 'load_project' tool using zod.
inputSchema: { path: z .string() .describe( "Absolute path to the Svelte project root directory" ), }, - src/tools/lifecycle.ts:12-40 (registration)Registration of the 'load_project' tool in the McpServer.
server.registerTool( "load_project", { title: "Load Project", description: "Load a Svelte project by its root directory. Restarts the language server pointed at the new workspace. Call this to switch between projects at runtime.", inputSchema: { path: z .string() .describe( "Absolute path to the Svelte project root directory" ), }, }, async ({ path }): Promise<ToolResult> => { try { const resolved = resolve(path); if (!existsSync(resolved)) { return textResult(`Directory not found: ${resolved}`); } await lsp.loadProject(resolved); return textResult( `Loaded project '${basename(resolved)}'. Language server is indexing - first requests may be slow.` ); } catch (ex) { return textResult(formatError(ex)); } } );