renderTableResult dispatches the `table=` drill-down path: it picks the unique match (or returns an appropriate error result) and renders it as TableDetail. schemaHint is the engine-adjusted schema filter (empty when dropped for single-schema engines) and is used for the candidate-lookup refetch too
(ctx context.Context, resolved *resolvedDatabase, input SchemaInput, schemaHint string, metadata *databaseMetadata, include string, warnings []string)
| 316 | // schemaHint is the engine-adjusted schema filter (empty when dropped for |
| 317 | // single-schema engines) and is used for the candidate-lookup refetch too. |
| 318 | func (s *Server) renderTableResult(ctx context.Context, resolved *resolvedDatabase, input SchemaInput, schemaHint string, metadata *databaseMetadata, include string, warnings []string) (*mcp.CallToolResult, any) { |
| 319 | matches := findTableMatches(metadata, input.Table) |
| 320 | switch { |
| 321 | case len(matches) == 0: |
| 322 | // Re-fetch without table filter to surface candidates. |
| 323 | candidates := s.lookupTableCandidates(ctx, resolved.resourceName, schemaHint, input.Table) |
| 324 | return formatTableNotFound(input.Database, input.Table, candidates), nil |
| 325 | case len(matches) > 1: |
| 326 | // Same table name in multiple schemas. Don't silently pick one. |
| 327 | schemas := make([]string, 0, len(matches)) |
| 328 | for _, m := range matches { |
| 329 | schemas = append(schemas, m.schema) |
| 330 | } |
| 331 | return formatAmbiguousTable(input.Database, input.Table, schemas), nil |
| 332 | } |
| 333 | entry := buildTableEntry(matches[0].table, schemaIncludeDetails) |
| 334 | output := &SchemaOutput{ |
| 335 | Database: resolved.resourceName, |
| 336 | Engine: resolved.engine, |
| 337 | Table: &entry, |
| 338 | } |
| 339 | return &mcp.CallToolResult{ |
| 340 | Content: []mcp.Content{&mcp.TextContent{Text: formatSchemaOutput(output, include, warnings)}}, |
| 341 | }, output |
| 342 | } |
| 343 | |
| 344 | // renderSchemasResult handles the bulk schema listing path (no table drill-down). |
| 345 | func renderSchemasResult(resolved *resolvedDatabase, metadata *databaseMetadata, include string, warnings []string) (*mcp.CallToolResult, any) { |
no test coverage detected