{"record":{"id":"8b55613e7f950ba4","repo":"continuedev/continue","slug":"invalid-url-based-mcp-tool-reference-toolref","errorCode":null,"errorMessage":"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).","messagePattern":"Invalid URL-based MCP tool reference \"(.+?)\": the part after the last colon must be either a port number or a valid tool name \\(alphanumeric, underscores, hyphens\\)\\.","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/config-yaml/src/markdown/agentFiles.ts","lineNumber":157,"sourceCode":"          afterLastColon === \"\" ||\n          /^[a-zA-Z0-9_-]+$/.test(afterLastColon)\n        ) {\n          // It's a tool name (or empty string)\n          // Reject references with whitespace to prevent silent misconfigurations\n          if (/\\s/.test(toolRef)) {\n            throw new Error(\n              `Invalid MCP tool reference \"${toolRef}\": colon-separated tool references cannot contain whitespace. ` +\n                `Use format \"https://server:tool_name\" without spaces.`,\n            );\n          }\n\n          const mcpServer = toolRef.substring(0, lastColonIndex);\n          const toolName = afterLastColon;\n\n          tools.push({ mcpServer, toolName });\n          mcpServerSet.add(mcpServer);\n        } else {\n          throw new Error(\n            `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).`,\n          );\n        }\n      } else {\n        // No colon after the protocol, treat the whole thing as the server\n        const mcpServer = toolRef;\n        tools.push({ mcpServer });\n        mcpServerSet.add(mcpServer);\n      }\n    } else if (toolRef.includes(\"/\")) {\n      // MCP tool reference: \"owner/package\" or \"owner/package:tool_name\"\n      const colonIndex = toolRef.indexOf(\":\");\n\n      if (colonIndex > 0) {\n        // Specific tool: \"owner/package:tool_name\"\n        // Reject references with whitespace to prevent silent misconfigurations\n        if (/\\s/.test(toolRef)) {\n          throw new Error(","sourceCodeStart":139,"sourceCodeEnd":175,"githubUrl":"https://github.com/continuedev/continue/blob/5522c6f44ca0ac3528b37244818fbfa39b5af470/packages/config-yaml/src/markdown/agentFiles.ts#L139-L175","documentation":"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.","triggerScenarios":"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.","commonSituations":"Passing full tool paths ('server:category/tool'), tool names with special characters, or malformed URLs.","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"],"exampleFix":"# before\ntools:\n  - \"https://server:cat/tool\"\n# after\ntools:\n  - \"https://server:tool\"","handlingStrategy":"validation","validationCode":"const ok = toolRefs.every(r => {\n  const after = r.substring(r.lastIndexOf(':') + 1);\n  return /^\\d+$/.test(after) || /^[a-zA-Z0-9_-]+$/.test(after);\n});","typeGuard":"function isValidUrlToolRef(ref: string): boolean {\n  const after = ref.substring(ref.lastIndexOf(':') + 1);\n  return /^\\d+$/.test(after) || /^[a-zA-Z0-9_-]+$/.test(after);\n}","tryCatchPattern":"try { parseAgentFileTools(refs); } catch (e) { if (e.message.includes('port number or a valid tool name')) { /* fix the tool name */ } }","preventionTips":["Use server-published tool names verbatim","Avoid path-like tool suffixes"],"tags":["mcp","tools","url","validation"],"backgroundTag":"malformed-tool-reference","analyzedSha":"5522c6f44ca0ac3528b37244818fbfa39b5af470","analyzedAt":"2026-08-27T11:28:54.683Z","schemaVersion":2},"datasetVersion":"2026-08-27T13:17:12.746Z"}