Skip to main content
Glama
boshyxd

Roblox Studio MCP Server

get_script_source

Retrieve the source code of a script object (LocalScript, Script, or ModuleScript) by specifying the instance path using the MCP server in Roblox Studio. Enables direct access to script data for development and debugging purposes.

Instructions

Get the source code of a script object (LocalScript, Script, or ModuleScript)

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
instancePathYesPath to the script instance (e.g., "game.ServerScriptService.MainScript")

Implementation Reference

  • The core handler function for the 'get_script_source' tool. It validates the instancePath, fetches the script source via an API request to '/api/get-script-source', formats the response as JSON text content, and returns it in MCP format.
    async getScriptSource(instancePath: string) {
      if (!instancePath) {
        throw new Error('Instance path is required for get_script_source');
      }
      const response = await this.client.request('/api/get-script-source', { instancePath });
      return {
        content: [
          {
            type: 'text',
            text: JSON.stringify(response, null, 2)
          }
        ]
      };
    }
  • Defines the tool schema including name, description, and input schema requiring 'instancePath' string for the get_script_source tool in the listTools response.
    {
      name: 'get_script_source',
      description: 'Get the source code of a script object (LocalScript, Script, or ModuleScript)',
      inputSchema: {
        type: 'object',
        properties: {
          instancePath: {
            type: 'string',
            description: 'Path to the script instance (e.g., "game.ServerScriptService.MainScript")'
          }
        },
        required: ['instancePath']
      }
    },
  • src/index.ts:712-713 (registration)
    MCP tool registration in the CallToolRequest handler switch statement, dispatching to this.tools.getScriptSource.
    case 'get_script_source':
      return await this.tools.getScriptSource((args as any)?.instancePath as string);
  • HTTP endpoint registration for '/mcp/get_script_source' that forwards requests to tools.getScriptSource and handles errors.
    app.post('/mcp/get_script_source', async (req, res) => {
      try {
        const result = await tools.getScriptSource(req.body.instancePath);
        res.json(result);
      } catch (error) {
        res.status(500).json({ error: error instanceof Error ? error.message : 'Unknown error' });
      }
    });
Behavior2/5

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

No annotations are provided, so the description carries full burden. While 'Get' implies a read operation, the description doesn't disclose important behavioral aspects: whether this requires specific permissions, what happens if the path is invalid or the object isn't a script, whether there are rate limits, what format the source code returns in, or if there are size limitations. The description only states what the tool does, not how it behaves.

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 a single, efficient sentence that directly states the tool's purpose without unnecessary words. It's appropriately sized for a simple retrieval tool and front-loads the core functionality. Every word earns its place in conveying the essential information.

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

Completeness2/5

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

For a tool with no annotations and no output schema, the description is insufficient. It doesn't explain what the return value looks like (string format, encoding, etc.), error conditions, or behavioral constraints. Given that this retrieves source code - potentially large or sensitive content - more context about the operation's behavior and output is needed for the agent to use it effectively.

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?

Schema description coverage is 100% with the instancePath parameter fully documented in the schema. The description adds no additional parameter semantics beyond what's already in the schema - it doesn't clarify path format requirements, validation rules, or provide examples beyond what's in the schema description. With complete schema coverage, baseline 3 is appropriate.

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 verb 'Get' and the resource 'source code of a script object', specifying the object types (LocalScript, Script, or ModuleScript). It distinguishes from siblings like get_instance_properties or get_file_tree by focusing specifically on script source code retrieval. However, it doesn't explicitly differentiate from set_script_source (which is the inverse operation).

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

Usage Guidelines2/5

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

The description provides no guidance on when to use this tool versus alternatives. It doesn't mention when to use get_script_source versus get_instance_properties (which might return metadata instead of source), or when to use it versus search_files/search_objects for finding scripts. There's no mention of prerequisites, error conditions, or typical use cases.

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

Related 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/boshyxd/robloxstudio-mcp'

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