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 "https://server:tool_name" without spaces. What it means
In parseAgentFileTools, a URL-like tool reference containing a colon was checked after the last colon; when it looks like a tool name/port but the whole reference contains whitespace, it is rejected to prevent silent misconfiguration.
Source
Thrown at packages/config-yaml/src/markdown/agentFiles.ts:145
// Check if there's a colon after the protocol
if (lastColonIndex > protocolEndIndex) {
const afterLastColon = toolRef.substring(lastColonIndex + 1);
// Check if it's a port number (only digits), empty string, or a tool name
if (/^\d+(?:$|[/?#])/.test(afterLastColon)) {
// It's a port number, treat the whole thing as the server
const mcpServer = toolRef;
tools.push({ mcpServer });
mcpServerSet.add(mcpServer);
} else if (
afterLastColon === "" ||
/^[a-zA-Z0-9_-]+$/.test(afterLastColon)
) {
// It's a tool name (or empty string)
// 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 "https://server:tool_name" without spaces.`,
);
}
const mcpServer = toolRef.substring(0, lastColonIndex);
const toolName = afterLastColon;
tools.push({ mcpServer, toolName });
mcpServerSet.add(mcpServer);
} else {
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;View on GitHub (pinned to 5522c6f44c)
Solutions
- Remove all whitespace from the URL-form tool reference
- Use the exact format https://server:tool_name
- Lint agent file tool lists for spaces
Example fix
# before tools: - "https://my server:tool_name" # after tools: - "https://myserver:tool_name"
Defensive patterns
Strategy: validation
Validate before calling
const valid = toolRefs.every(r => /^\S+$/.test(r));
Type guard
function isCleanToolRef(ref: string): boolean { return !/\s/.test(ref); } Try / catch
try { parseAgentFileTools(refs); } catch (e) { if (e.message.includes('whitespace')) { /* strip spaces and retry */ } } Prevention
- Quote tool references in YAML lists
- Trim copy/pasted references
When it happens
Trigger: A tools entry like 'https://my server:tool_name' or 'https://server:my tool' — URL-form reference with any whitespace anywhere in the string.
Common situations: Copy/pasting tool references with trailing spaces or line-wrapped URLs, or YAML flow lists inserting spaces.
Related errors
- Invalid MCP tool reference "${toolRef}": colon-separated too
- Invalid URL-based MCP tool reference "${toolRef}": the part
- No MCP connection found for ${mcpId}
- Continue currently only supports text resources from MCP
- Config not loaded
AI-assisted analysis of continuedev/continue@5522c6f44c (2026-08-27).
Data as JSON: /api/errors/652bb8909bb6a74c.
Report an issue: GitHub.