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

Function formatTableNotFound

backend/api/mcp/tool_schema.go:736–754  ·  view source on GitHub ↗

formatTableNotFound returns an MCP result for the TABLE_NOT_FOUND error path.

(database, table string, candidates []string)

Source from the content-addressed store, hash-verified

734
735// formatTableNotFound returns an MCP result for the TABLE_NOT_FOUND error path.
736func formatTableNotFound(database, table string, candidates []string) *mcp.CallToolResult {
737 result := struct {
738 Code string `json:"code"`
739 Message string `json:"message"`
740 Suggestion string `json:"suggestion"`
741 Candidates []string `json:"candidates,omitempty"`
742 }{
743 Code: "TABLE_NOT_FOUND",
744 Message: fmt.Sprintf("no table matching %q in %s", table, database),
745 Suggestion: "call get_schema without table= to see available tables",
746 Candidates: candidates,
747 }
748
749 jsonBytes, _ := json.MarshalIndent(result, "", " ")
750 return &mcp.CallToolResult{
751 Content: []mcp.Content{&mcp.TextContent{Text: string(jsonBytes)}},
752 IsError: true,
753 }
754}
755
756// formatAmbiguousTable returns an MCP result when the requested table name
757// exists in multiple schemas. The caller must pick a schema.

Callers 1

renderTableResultMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected