{"record":{"id":"92bb4847b5e5c109","repo":"sipeed/picoclaw","slug":"server-name-is-required","errorCode":null,"errorMessage":"server name is required","messagePattern":"server name is required","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"pkg/agent/agent_command.go","lineNumber":188,"sourceCode":"\t\t\t\t\tConnected: isConnected,\n\t\t\t\t\tToolCount: toolCount,\n\t\t\t\t})\n\t\t\t}\n\n\t\t\tsort.Slice(servers, func(i, j int) bool {\n\t\t\t\treturn strings.ToLower(servers[i].Name) < strings.ToLower(servers[j].Name)\n\t\t\t})\n\n\t\t\treturn servers\n\t\t},\n\t\tListMCPTools: func(ctx context.Context, serverName string) ([]commands.MCPToolInfo, error) {\n\t\t\tif cfg == nil {\n\t\t\t\treturn nil, fmt.Errorf(\"command unavailable: config not loaded\")\n\t\t\t}\n\n\t\t\tserverName = strings.TrimSpace(serverName)\n\t\t\tif serverName == \"\" {\n\t\t\t\treturn nil, fmt.Errorf(\"server name is required\")\n\t\t\t}\n\n\t\t\tresolvedName := \"\"\n\t\t\tvar serverCfg config.MCPServerConfig\n\t\t\tfor name, candidate := range cfg.Tools.MCP.Servers {\n\t\t\t\tif strings.EqualFold(name, serverName) {\n\t\t\t\t\tresolvedName = name\n\t\t\t\t\tserverCfg = candidate\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t}\n\t\t\tif resolvedName == \"\" {\n\t\t\t\treturn nil, fmt.Errorf(\"MCP server '%s' is not configured\", serverName)\n\t\t\t}\n\t\t\tif !serverCfg.Enabled {\n\t\t\t\treturn nil, fmt.Errorf(\"MCP server '%s' is configured but disabled\", resolvedName)\n\t\t\t}\n\t\t\tif !cfg.Tools.IsToolEnabled(\"mcp\") {","sourceCodeStart":170,"sourceCodeEnd":206,"githubUrl":"https://github.com/sipeed/picoclaw/blob/49183d7e8daed0dba89ddbb6fcb60089401d9680/pkg/agent/agent_command.go#L170-L206","documentation":"ListMCPTools trims whitespace from the server-name argument and rejects an empty result. The MCP tool-listing command needs a concrete server name to look up in cfg.Tools.MCP.Servers, so a blank or whitespace-only name is refused before any resolution happens.","triggerScenarios":"Calling the slash command with no argument or only spaces (e.g. `/mcp tools \" \"`), or programmatically passing \"\" / \"\\t\" to the ListMCPTools hook.","commonSituations":"User omits the server argument; templating code substitutes an empty variable into the command; argument parsing drops the name (unquoted shell expansion of an unset var).","solutions":["Provide the server name exactly as configured, e.g. /mcp tools clawhub","List configured servers first via the ListMCPServers hook (/mcp list) and pick a name","In generated invocations, guard template variables: only render the command when the name is non-empty"],"exampleFix":"# before\n/mcp tools \"\"\n\n# after\n/mcp tools clawhub","handlingStrategy":"validation","validationCode":"if strings.TrimSpace(serverName) == \"\" {\n    return fmt.Errorf(\"provide a server name, e.g. /mcp tools clawhub\")\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Require a non-empty argument in command parsers before dispatch","Default template variables to a known server name or skip the call"],"tags":["validation","mcp","runtime"],"backgroundTag":null,"analyzedSha":"49183d7e8daed0dba89ddbb6fcb60089401d9680","analyzedAt":"2026-08-15T21:55:41.315Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}