MCPcopy Create free account
hub / github.com/bytebase/bytebase / formatAmbiguousTable

Function formatAmbiguousTable

backend/api/mcp/tool_schema.go:758–776  ·  view source on GitHub ↗

formatAmbiguousTable returns an MCP result when the requested table name exists in multiple schemas. The caller must pick a schema.

(database, table string, schemas []string)

Source from the content-addressed store, hash-verified

756// formatAmbiguousTable returns an MCP result when the requested table name
757// exists in multiple schemas. The caller must pick a schema.
758func formatAmbiguousTable(database, table string, schemas []string) *mcp.CallToolResult {
759 result := struct {
760 Code string `json:"code"`
761 Message string `json:"message"`
762 Suggestion string `json:"suggestion"`
763 Schemas []string `json:"schemas"`
764 }{
765 Code: "AMBIGUOUS_TABLE",
766 Message: fmt.Sprintf("table %q exists in multiple schemas of %s", table, database),
767 Suggestion: fmt.Sprintf("re-run with schema= set to one of: %s", strings.Join(schemas, ", ")),
768 Schemas: schemas,
769 }
770
771 jsonBytes, _ := json.MarshalIndent(result, "", " ")
772 return &mcp.CallToolResult{
773 Content: []mcp.Content{&mcp.TextContent{Text: string(jsonBytes)}},
774 IsError: true,
775 }
776}

Callers 1

renderTableResultMethod · 0.85

Calls 1

JoinMethod · 0.80

Tested by

no test coverage detected