formatAmbiguousResult returns an MCP result for ambiguous database matches.
(database string, candidates []Candidate)
| 323 | |
| 324 | // formatAmbiguousResult returns an MCP result for ambiguous database matches. |
| 325 | func formatAmbiguousResult(database string, candidates []Candidate) *mcp.CallToolResult { |
| 326 | result := struct { |
| 327 | Code string `json:"code"` |
| 328 | Message string `json:"message"` |
| 329 | Candidates []Candidate `json:"candidates"` |
| 330 | }{ |
| 331 | Code: "AMBIGUOUS_TARGET", |
| 332 | Message: fmt.Sprintf("Multiple databases match %q. Specify instance or project to narrow.", database), |
| 333 | Candidates: candidates, |
| 334 | } |
| 335 | |
| 336 | jsonBytes, _ := json.MarshalIndent(result, "", " ") |
| 337 | return &mcp.CallToolResult{ |
| 338 | Content: []mcp.Content{&mcp.TextContent{Text: string(jsonBytes)}}, |
| 339 | IsError: true, |
| 340 | } |
| 341 | } |
no outgoing calls