Get Started

Use the Script Editor Quickly and Safely

This page helps you get started with the MCPStudio JavaScript editor and shows the fastest workflow from first file to test run.

Updated: April 16, 2026

What you need

  • An open MCPStudio workspace structure
  • Basic JavaScript and JSON knowledge
  • Access to the log panel for testing

Quick start in 5 steps

  1. Click New Script in the toolbar and choose the right script type.
  2. Name the script and place it in a clean folder structure.
  3. Write your code and save with Save File.
  4. Run it with Run Script and check the output in the log.
  5. If it works, save a version or share it via Export Custom Tool SDK.

Recommended daily workflow

1. Keep files organized

Use the file browser on the left as your main navigation. Create topic-based folders so scripts stay easy to find.

2. Build in small increments

Implement one handler, then test it. This makes debugging much faster than running large changes at once.

3. Keep the log visible

The log panel is your most important debugging source. Keep it open while developing.

Tip: Use Search/Replace to keep handler names and JSON field names consistent.

Minimal script structure

The central entry function is toolEntry(sid, handlerName, jsonParams).

function toolEntry(sid, handlerName, jsonParams) {
    try {
        const params = JSON.parse(jsonParams || "{}");
        if (handlerName === "ping") {
            return JSON.stringify({ ok: true, sid: sid, input: params });
        }
        return JSON.stringify({ error: "Unknown handler: " + handlerName });
    } catch (e) {
        return JSON.stringify({ error: e.message });
    }
}

Start with a small handler like ping and expand step by step.

Common errors and quick fixes

  • JSON parse error: Input is not valid JSON. Test with a small valid JSON object.
  • Unknown handler: Handler name in tool config does not match your script.
  • No output in log: Script was not saved or log view is hidden.
Important: Always save before each test run, otherwise an old version may still execute.

Next steps