sipeed/picoclaw · warning

server name is required

Error message

server name is required

What it means

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.

Source

Thrown at pkg/agent/agent_command.go:188

					Connected: isConnected,
					ToolCount: toolCount,
				})
			}

			sort.Slice(servers, func(i, j int) bool {
				return strings.ToLower(servers[i].Name) < strings.ToLower(servers[j].Name)
			})

			return servers
		},
		ListMCPTools: func(ctx context.Context, serverName string) ([]commands.MCPToolInfo, error) {
			if cfg == nil {
				return nil, fmt.Errorf("command unavailable: config not loaded")
			}

			serverName = strings.TrimSpace(serverName)
			if serverName == "" {
				return nil, fmt.Errorf("server name is required")
			}

			resolvedName := ""
			var serverCfg config.MCPServerConfig
			for name, candidate := range cfg.Tools.MCP.Servers {
				if strings.EqualFold(name, serverName) {
					resolvedName = name
					serverCfg = candidate
					break
				}
			}
			if resolvedName == "" {
				return nil, fmt.Errorf("MCP server '%s' is not configured", serverName)
			}
			if !serverCfg.Enabled {
				return nil, fmt.Errorf("MCP server '%s' is configured but disabled", resolvedName)
			}
			if !cfg.Tools.IsToolEnabled("mcp") {

View on GitHub (pinned to 49183d7e8d)

Solutions

  1. Provide the server name exactly as configured, e.g. /mcp tools clawhub
  2. List configured servers first via the ListMCPServers hook (/mcp list) and pick a name
  3. In generated invocations, guard template variables: only render the command when the name is non-empty

Example fix

# before
/mcp tools ""

# after
/mcp tools clawhub
Defensive patterns

Strategy: validation

Validate before calling

if strings.TrimSpace(serverName) == "" {
    return fmt.Errorf("provide a server name, e.g. /mcp tools clawhub")
}

Prevention

When it happens

Trigger: Calling the slash command with no argument or only spaces (e.g. `/mcp tools " "`), or programmatically passing "" / "\t" to the ListMCPTools hook.

Common situations: 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).

Related errors


AI-assisted analysis of sipeed/picoclaw@49183d7e8d (2026-08-15). Data as JSON: /api/errors/92bb4847b5e5c109. Report an issue: GitHub.