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

Function resolveIncludeLevel

backend/api/mcp/tool_schema.go:279–291  ·  view source on GitHub ↗

resolveIncludeLevel normalizes and validates the `include` parameter. When empty, it defaults to "details" if a table was requested and "summary" otherwise.

(input SchemaInput)

Source from the content-addressed store, hash-verified

277// resolveIncludeLevel normalizes and validates the `include` parameter.
278// When empty, it defaults to "details" if a table was requested and "summary" otherwise.
279func resolveIncludeLevel(input SchemaInput) (string, error) {
280 include := input.Include
281 if include == "" {
282 if input.Table != "" {
283 return schemaIncludeDetails, nil
284 }
285 return schemaIncludeSummary, nil
286 }
287 if include != schemaIncludeSummary && include != schemaIncludeColumns && include != schemaIncludeDetails {
288 return "", errors.Errorf("invalid include value %q (must be summary|columns|details)", input.Include)
289 }
290 return include, nil
291}
292
293// resolveSchemaTarget runs the shared database resolver and handles the ambiguous
294// case with elicitation fallback. Returns either a resolved database (on success)

Callers 1

handleGetSchemaMethod · 0.85

Calls 1

ErrorfMethod · 0.80

Tested by

no test coverage detected