continuedev/continue · error · Error
Invalid URL-based MCP tool reference "${toolRef}": the part
Error message
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). What it means
For a URL-based tool reference with a colon after the protocol, the segment after the last colon must be a port number or match /^[a-zA-Z0-9_-]+$/ (tool name). Anything else triggers this error.
Source
Thrown at packages/config-yaml/src/markdown/agentFiles.ts:157
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;
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(View on GitHub (pinned to 5522c6f44c)
Solutions
- Use only alphanumeric, underscore, and hyphen in the tool name after the colon
- Move path-like structure into the server part or drop it
- Verify against the actual MCP server's published tool names
Example fix
# before tools: - "https://server:cat/tool" # after tools: - "https://server:tool"
Defensive patterns
Strategy: validation
Validate before calling
const ok = toolRefs.every(r => {
const after = r.substring(r.lastIndexOf(':') + 1);
return /^\d+$/.test(after) || /^[a-zA-Z0-9_-]+$/.test(after);
}); Type guard
function isValidUrlToolRef(ref: string): boolean {
const after = ref.substring(ref.lastIndexOf(':') + 1);
return /^\d+$/.test(after) || /^[a-zA-Z0-9_-]+$/.test(after);
} Try / catch
try { parseAgentFileTools(refs); } catch (e) { if (e.message.includes('port number or a valid tool name')) { /* fix the tool name */ } } Prevention
- Use server-published tool names verbatim
- Avoid path-like tool suffixes
When it happens
Trigger: A tools entry like 'https://server:tool.name!' or 'https://server:tool name' — post-colon segment containing dots, slashes, or other non-[a-zA-Z0-9_-] characters when not a port.
Common situations: Passing full tool paths ('server:category/tool'), tool names with special characters, or malformed URLs.
Related errors
- Invalid MCP tool reference "${toolRef}": colon-separated too
- Invalid MCP tool reference "${toolRef}": colon-separated too
- node-fetch cannot load ${url}. URL scheme "${parsedURL.proto
- Unsupported tool type in Bedrock: ${tool.type}
- No MCP connection found for ${mcpId}
AI-assisted analysis of continuedev/continue@5522c6f44c (2026-08-27).
Data as JSON: /api/errors/8b55613e7f950ba4.
Report an issue: GitHub.