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

Function writeSchemasHeader

backend/api/mcp/tool_schema.go:692–708  ·  view source on GitHub ↗

writeSchemasHeader writes the multi-schema overview header lines.

(sb *strings.Builder, sections []SchemaSection, include string)

Source from the content-addressed store, hash-verified

690
691// writeSchemasHeader writes the multi-schema overview header lines.
692func writeSchemasHeader(sb *strings.Builder, sections []SchemaSection, include string) {
693 stats := summarizeSchemas(sections)
694 if len(stats.schemaNames) > 0 {
695 fmt.Fprintf(sb, "Schemas: %d (%s)\n", len(sections), strings.Join(stats.schemaNames, ", "))
696 }
697 switch include {
698 case schemaIncludeColumns:
699 fmt.Fprintf(sb, "Tables: %d (showing columns) | Views: %d\n", stats.totalTables, stats.totalViews)
700 case schemaIncludeDetails:
701 fmt.Fprintf(sb, "Tables: %d (showing details) | Views: %d\n", stats.totalTables, stats.totalViews)
702 default:
703 fmt.Fprintf(sb, "Tables: %d | Views: %d | Functions: %d\n", stats.totalTables, stats.totalViews, stats.totalFunctions)
704 }
705 if stats.truncatedAny {
706 fmt.Fprintf(sb, "Truncated: some schemas hit the %d-table limit per schema. Use schema= or table= to narrow.\n", schemaTableLimit)
707 }
708}
709
710// schemaStats aggregates per-schema counters for header rendering.
711type schemaStats struct {

Callers 1

formatSchemaOutputFunction · 0.85

Calls 2

summarizeSchemasFunction · 0.85
JoinMethod · 0.80

Tested by

no test coverage detected