resolveSchemaTarget runs the shared database resolver and handles the ambiguous case with elicitation fallback. Returns either a resolved database (on success) or a non-nil CallToolResult describing the error for the caller to return.
(ctx context.Context, req *mcp.CallToolRequest, input SchemaInput)
| 294 | // case with elicitation fallback. Returns either a resolved database (on success) |
| 295 | // or a non-nil CallToolResult describing the error for the caller to return. |
| 296 | func (s *Server) resolveSchemaTarget(ctx context.Context, req *mcp.CallToolRequest, input SchemaInput) (*resolvedDatabase, *mcp.CallToolResult) { |
| 297 | resolveCtx, resolveCancel := context.WithTimeout(ctx, resolveTimeout) |
| 298 | defer resolveCancel() |
| 299 | |
| 300 | resolved, err := s.resolveDatabase(resolveCtx, input.Database, input.Instance, input.Project) |
| 301 | if err != nil { |
| 302 | return nil, formatToolError(err) |
| 303 | } |
| 304 | if !resolved.ambiguous { |
| 305 | return resolved, nil |
| 306 | } |
| 307 | picked, elicitErr := s.elicitDatabaseChoice(ctx, req, resolved) |
| 308 | if elicitErr != nil { |
| 309 | return nil, formatAmbiguousResult(input.Database, resolved.candidates) |
| 310 | } |
| 311 | return picked, nil |
| 312 | } |
| 313 | |
| 314 | // renderTableResult dispatches the `table=` drill-down path: it picks the unique |
| 315 | // match (or returns an appropriate error result) and renders it as TableDetail. |
no test coverage detected