{"record":{"id":"ec16714ed3b7d990","repo":"multica-ai/multica","slug":"list-agent-mcp-servers-w","errorCode":null,"errorMessage":"list agent mcp servers: %w","messagePattern":"list agent mcp servers: %w","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"server/cmd/multica/cmd_agent_mcp.go","lineNumber":105,"sourceCode":"\tpath := \"/api/agents/\" + url.PathEscape(agentID) + \"/mcp-servers\"\n\tfor _, part := range parts {\n\t\tpath += \"/\" + url.PathEscape(part)\n\t}\n\treturn path\n}\n\nfunc runAgentMcpList(cmd *cobra.Command, args []string) error {\n\tagentID := strings.TrimSpace(args[0])\n\tclient, err := newAPIClient(cmd)\n\tif err != nil {\n\t\treturn err\n\t}\n\tctx, cancel := cli.APIContext(context.Background())\n\tdefer cancel()\n\n\tvar servers []workspaceMcpServer\n\tif err := client.GetJSON(ctx, agentMcpPath(agentID), &servers); err != nil {\n\t\treturn fmt.Errorf(\"list agent mcp servers: %w\", err)\n\t}\n\treturn printWorkspaceMcpServers(cmd, servers)\n}\n\nfunc runAgentMcpAdd(cmd *cobra.Command, args []string) error {\n\tagentID, serverID := strings.TrimSpace(args[0]), strings.TrimSpace(args[1])\n\tclient, err := newAPIClient(cmd)\n\tif err != nil {\n\t\treturn err\n\t}\n\tctx, cancel := cli.APIContext(context.Background())\n\tdefer cancel()\n\n\tvar servers []workspaceMcpServer\n\tbody := map[string]any{\"server_id\": serverID}\n\tif err := client.PostJSON(ctx, agentMcpPath(agentID), body, &servers); err != nil {\n\t\treturn fmt.Errorf(\"add agent mcp server: %w\", err)\n\t}","sourceCodeStart":87,"sourceCodeEnd":123,"githubUrl":"https://github.com/multica-ai/multica/blob/2c0912b6ec764b373d44eeea1e80f0d9f11ab417/server/cmd/multica/cmd_agent_mcp.go#L87-L123","documentation":"Thrown by `multica agent mcp list <agentID>` when GET /api/agents/{id}/mcp-servers fails. The wrapped error carries the HTTP cause: unknown agent ID (404), auth failure (401/403), or connectivity problems to the API server.","triggerScenarios":"`multica agent mcp list <bad-id>`; agent deleted before the call; wrong API base URL or expired token; server down.","commonSituations":"Agent IDs stale after re-deploys that recreate agents; scripts iterating over IDs saved from an earlier run; environment mismatch between CLI config and where the agent lives.","solutions":["Confirm the agent exists: multica agent list, then re-run with a fresh ID","Fix auth/connectivity: check the CLI's server URL and token, re-login if expired","Trim whitespace — the CLI trims args, but ensure you are not passing a labeled output like 'ID' column headers"],"exampleFix":"# before\nmultica agent mcp list abc123   # deleted agent\n# after\nmultica agent list --output json | jq '.[].id'\nmultica agent mcp list <fresh-id>","handlingStrategy":"try-catch","validationCode":"multica agent get \"$AGENT_ID\" >/dev/null 2>&1 || { echo \"agent $AGENT_ID not found\" >&2; exit 1; }\nmultica agent mcp list \"$AGENT_ID\"","typeGuard":null,"tryCatchPattern":"In Go: var servers []workspaceMcpServer; if err := client.GetJSON(ctx, agentMcpPath(agentID), &servers); err != nil { return fmt.Errorf(\"list agent mcp servers: %w\", err) } — inspect the wrapped error's HTTP status: 404 → bad agent ID, 401/403 → auth, network → retry.","preventionTips":["Resolve agent IDs from a fresh listing in the same environment","Run a cheap authenticated call first to catch token/URL problems early","In scripts, fail fast on the first API error rather than continuing with stale IDs"],"tags":["cli","api","http","mcp","go"],"backgroundTag":null,"analyzedSha":"2c0912b6ec764b373d44eeea1e80f0d9f11ab417","analyzedAt":"2026-08-15T13:25:18.241Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}