Skip to main content
Glama

Get Compiled Code

get_compiled_code

Retrieve compiled JavaScript and CSS output for Svelte components to debug compilation issues and analyze generated code.

Instructions

Get the compiled JavaScript and CSS output for a Svelte component. Useful for debugging compilation issues.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
filePathYesAbsolute path to the .svelte file

Implementation Reference

  • Registration of the "get_compiled_code" tool in Svelte tools module.
    server.registerTool(
      "get_compiled_code",
      {
        title: "Get Compiled Code",
        description:
          "Get the compiled JavaScript and CSS output for a Svelte component. Useful for debugging compilation issues.",
        inputSchema: z.object({
          filePath: z
            .string()
            .describe("Absolute path to the .svelte file"),
        }),
      },
  • Handler implementation for "get_compiled_code", which makes an LSP request to '$/getCompiledCode'.
    async ({ filePath }): Promise<ToolResult> => {
      try {
        const prep = await prepareDocumentRequest(lsp, filePath);
        if ("error" in prep) return textResult(prep.error);
    
        const result = await lsp.request("$/getCompiledCode", prep.uri);
    
        if (!result) {
          return textResult(
            `No compiled code available for ${basename(filePath)}.`
          );
        }
    
        const parts: string[] = [];
    
        if (result.js) {
          parts.push("=== Compiled JavaScript ===");
          parts.push(result.js);
        }
    
        if (result.css) {
          parts.push("");
          parts.push("=== Compiled CSS ===");
          parts.push(result.css);
        }
    
        if (parts.length === 0) {
          return textResult(
            `Compiled code for ${basename(filePath)} is empty.`
          );
        }
    
        return textResult(parts.join("\n"));
      } catch (ex) {
        return textResult(formatError(ex));
      }
    }
  • Input schema definition for the "get_compiled_code" tool using Zod.
    inputSchema: z.object({
      filePath: z
        .string()
        .describe("Absolute path to the .svelte file"),
    }),
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries the full burden of behavioral disclosure. It mentions the tool is 'Useful for debugging compilation issues,' which hints at a read-only, diagnostic purpose, but it doesn't explicitly state whether this is a safe read operation, what permissions are needed, or details about the output format (e.g., structure, potential errors). For a tool with zero annotation coverage, this is insufficient to fully inform an agent.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is appropriately sized and front-loaded: the first sentence clearly states the purpose, and the second sentence adds useful context without redundancy. There is zero waste, making it efficient and easy for an agent to parse.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool's moderate complexity (single parameter, no output schema, no annotations), the description is partially complete. It covers the purpose and usage context but lacks details on behavioral traits (e.g., safety, output format) and doesn't compensate for the absence of an output schema. This makes it adequate but with clear gaps for an agent to rely on.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The input schema has 100% description coverage, with the parameter 'filePath' documented as 'Absolute path to the .svelte file.' The description doesn't add any additional meaning beyond this, such as examples or constraints. According to the rules, with high schema coverage (>80%), the baseline score is 3, as the schema already provides adequate parameter information.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool's purpose: 'Get the compiled JavaScript and CSS output for a Svelte component.' It specifies the verb ('Get'), resource ('compiled JavaScript and CSS output'), and target ('Svelte component'). However, it doesn't explicitly differentiate from sibling tools like 'get_diagnostics' or 'get_completion' which might also relate to Svelte components, so it doesn't reach the highest score.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides implied usage guidance with 'Useful for debugging compilation issues,' which suggests a context for when to use this tool. However, it doesn't explicitly state when to use it versus alternatives (e.g., 'get_diagnostics' for error checking or 'get_completion' for code suggestions), nor does it mention any prerequisites or exclusions, leaving gaps in guidance.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

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