Skip to main content
Glama

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
NameRequiredDescriptionDefault
pathYesAbsolute path to the Svelte project root directory

Implementation Reference

  • 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));
      }
    }
  • Input schema definition for the 'load_project' tool using zod.
    inputSchema: {
      path: z
        .string()
        .describe(
          "Absolute path to the Svelte project root directory"
        ),
    },
  • 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));
        }
      }
    );

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/adainrivers/SvelteLS.MCP'

If you have feedback or need assistance with the MCP directory API, please join our Discord server