MCPcopy Create free account
hub / github.com/ajitpratap0/GoSQLX / handleValidateSQL

Function handleValidateSQL

pkg/mcp/tools.go:255–266  ·  view source on GitHub ↗

--------------------------------------------------------------------------- MCP handler functions --------------------------------------------------------------------------- handleValidateSQL is the MCP tool handler for "validate_sql".

(ctx context.Context, req mcpmcp.CallToolRequest)

Source from the content-addressed store, hash-verified

253
254// handleValidateSQL is the MCP tool handler for "validate_sql".
255func handleValidateSQL(ctx context.Context, req mcpmcp.CallToolRequest) (*mcpmcp.CallToolResult, error) {
256 sql := req.GetString("sql", "")
257 if sql == "" {
258 return nil, fmt.Errorf("parameter 'sql' is required and must not be empty")
259 }
260 dialect := req.GetString("dialect", "")
261 result, err := validateSQLInternal(sql, dialect)
262 if err != nil {
263 return nil, err
264 }
265 return toolResult(result)
266}
267
268// handleFormatSQL is the MCP tool handler for "format_sql".
269func handleFormatSQL(ctx context.Context, req mcpmcp.CallToolRequest) (*mcpmcp.CallToolResult, error) {

Callers 3

TestHandleValidateSQLFunction · 0.85

Calls 3

validateSQLInternalFunction · 0.85
toolResultFunction · 0.85
ErrorfMethod · 0.65

Tested by 3

TestHandleValidateSQLFunction · 0.68