continuedev/continue · error · Error

Invalid MCP tool reference "${toolRef}": colon-separated too

Error message

Invalid MCP tool reference "${toolRef}": colon-separated tool references cannot contain whitespace. Use format "owner/slug:tool_name" without spaces.

What it means

For non-URL tool references containing a colon ('owner/package:tool_name'), any whitespace in the reference is rejected before parsing to avoid silently splitting into wrong server/tool parts.

Source

Thrown at packages/config-yaml/src/markdown/agentFiles.ts:175

          throw new Error(
            `Invalid URL-based MCP tool reference "${toolRef}": the part after the last colon must be either a port number or a valid tool name (alphanumeric, underscores, hyphens).`,
          );
        }
      } else {
        // No colon after the protocol, treat the whole thing as the server
        const mcpServer = toolRef;
        tools.push({ mcpServer });
        mcpServerSet.add(mcpServer);
      }
    } else if (toolRef.includes("/")) {
      // MCP tool reference: "owner/package" or "owner/package:tool_name"
      const colonIndex = toolRef.indexOf(":");

      if (colonIndex > 0) {
        // Specific tool: "owner/package:tool_name"
        // Reject references with whitespace to prevent silent misconfigurations
        if (/\s/.test(toolRef)) {
          throw new Error(
            `Invalid MCP tool reference "${toolRef}": colon-separated tool references cannot contain whitespace. ` +
              `Use format "owner/slug:tool_name" without spaces.`,
          );
        }

        const mcpServer = toolRef.substring(0, colonIndex);
        const toolName = toolRef.substring(colonIndex + 1);

        tools.push({ mcpServer, toolName });
        mcpServerSet.add(mcpServer);
      } else {
        // All tools from server: "owner/package"
        const mcpServer = toolRef;

        tools.push({ mcpServer });
        mcpServerSet.add(mcpServer);
      }
    } else {

View on GitHub (pinned to 5522c6f44c)

Solutions

  1. Strip whitespace from the reference
  2. Quote the YAML entry if needed and keep the exact owner/slug:tool_name form
  3. Check for stray template variable whitespace like ${{ x }} output

Example fix

# before
tools:
  - owner/slug:my tool
# after
tools:
  - owner/slug:my_tool
Defensive patterns

Strategy: validation

Validate before calling

const ok = toolRefs.every(r => !/\s/.test(r));

Type guard

function isCleanSlugToolRef(ref: string): boolean { return !/\s/.test(ref) && ref.split(':').length <= 2; }

Try / catch

try { parseAgentFileTools(refs); } catch (e) { if (e.message.includes('whitespace')) { /* strip whitespace, retry */ } }

Prevention

When it happens

Trigger: A tools entry like 'owner/slug:my tool' or ' owner/slug:tool' — slug-form reference containing spaces or tabs.

Common situations: YAML lists with unquoted entries containing spaces, copy/paste artifacts, or templating inserting whitespace.

Related errors


AI-assisted analysis of continuedev/continue@5522c6f44c (2026-08-27). Data as JSON: /api/errors/c0d174addbd009a6. Report an issue: GitHub.