@@ -166,7 +166,7 @@ func newMCPServer(config *Config, backend Backend, logger *logrus.Logger) (MCPSe
166166 server ,
167167 & mcp.Tool {
168168 Name : "query_v2" ,
169- Description : "Execute a SQL query. Please adhere to the expected parameters. Returns a textual response" ,
169+ Description : "Deprecated: Please switch to query_v3. Execute a SQL query. Please adhere to the expected parameters. Returns a textual response" ,
170170 // Input and output schemas can be defined here if needed.
171171 },
172172 func (ctx context.Context , req * mcp.CallToolRequest , arg dto.QueryInput ) (* mcp.CallToolResult , any , error ) {
@@ -279,7 +279,7 @@ func newMCPServer(config *Config, backend Backend, logger *logrus.Logger) (MCPSe
279279 server ,
280280 & mcp.Tool {
281281 Name : "prompt_write_safe_select_tool" ,
282- Description : "Prompt: guidelines for writing safe SELECT queries." ,
282+ Description : "PLACEHOLDER Future proofing: prompt guidelines for writing safe SELECT queries." ,
283283 },
284284 func (ctx context.Context , req * mcp.CallToolRequest , args dto.HierarchyInput ) (* mcp.CallToolResult , any , error ) {
285285 result , err := backend .PromptWriteSafeSelectTool (ctx , args )
@@ -292,25 +292,6 @@ func newMCPServer(config *Config, backend Backend, logger *logrus.Logger) (MCPSe
292292 },
293293 )
294294
295- // mcp.AddTool(
296- // server,
297- // &mcp.Tool{
298- // Name: "prompt_explain_plan_tips_tool",
299- // Description: "Prompt: tips for reading EXPLAIN ANALYZE output.",
300- // },
301- // func(ctx context.Context, req *mcp.CallToolRequest, _ any) (*mcp.CallToolResult, any, error) {
302- // result, err := backend.PromptExplainPlanTipsTool(ctx)
303- // if err != nil {
304- // return nil, nil, err
305- // }
306- // return &mcp.CallToolResult{
307- // Content: []mcp.Content{
308- // &mcp.TextContent{Text: result},
309- // },
310- // }, result, nil
311- // },
312- // )
313-
314295 mcp .AddTool (
315296 server ,
316297 & mcp.Tool {
@@ -338,7 +319,7 @@ func newMCPServer(config *Config, backend Backend, logger *logrus.Logger) (MCPSe
338319 server ,
339320 & mcp.Tool {
340321 Name : "list_tables_json_page" ,
341- Description : "List tables with pagination and filters, returns JSON." ,
322+ Description : "Future proofing: List tables with pagination and filters, returns JSON." ,
342323 },
343324 func (ctx context.Context , req * mcp.CallToolRequest , args dto.ListTablesPageInput ) (* mcp.CallToolResult , any , error ) {
344325 result , err := backend .ListTablesJSONPage (ctx , args )
@@ -429,7 +410,7 @@ func newMCPServer(config *Config, backend Backend, logger *logrus.Logger) (MCPSe
429410 server ,
430411 & mcp.Tool {
431412 Name : "describe_table" ,
432- Description : "Get detailed information about a table." ,
413+ Description : "PLACEHOLDER Future proofing: Get detailed information about a table." ,
433414 },
434415 func (ctx context.Context , req * mcp.CallToolRequest , args dto.HierarchyInput ) (* mcp.CallToolResult , any , error ) {
435416 result , err := backend .DescribeTable (ctx , args )
@@ -446,7 +427,7 @@ func newMCPServer(config *Config, backend Backend, logger *logrus.Logger) (MCPSe
446427 server ,
447428 & mcp.Tool {
448429 Name : "get_foreign_keys" ,
449- Description : "Get foreign key information for a table." ,
430+ Description : "PLACEHOLDER Future proofing: Get foreign key information for a table." ,
450431 },
451432 func (ctx context.Context , req * mcp.CallToolRequest , args dto.HierarchyInput ) (* mcp.CallToolResult , any , error ) {
452433 result , err := backend .GetForeignKeys (ctx , args )
@@ -463,7 +444,7 @@ func newMCPServer(config *Config, backend Backend, logger *logrus.Logger) (MCPSe
463444 server ,
464445 & mcp.Tool {
465446 Name : "find_relationships" ,
466- Description : "Find explicit and implied relationships for a table." ,
447+ Description : "PLACEHOLDER Future proofing: Find explicit and implied relationships for a table." ,
467448 },
468449 func (ctx context.Context , req * mcp.CallToolRequest , args dto.HierarchyInput ) (* mcp.CallToolResult , any , error ) {
469450 result , err := backend .FindRelationships (ctx , args )
@@ -476,10 +457,6 @@ func newMCPServer(config *Config, backend Backend, logger *logrus.Logger) (MCPSe
476457 },
477458 )
478459
479- // --- new: register namespaced meta.* and query.* tools ---
480- registerNamespacedTools (server , backend , logger )
481- // ---------------------------------------------------------
482-
483460 return & simpleMCPServer {
484461 config : config ,
485462 backend : backend ,
@@ -553,137 +530,3 @@ func (s *simpleMCPServer) Stop() error {
553530 s .logger .Printf ("MCP server stopped" )
554531 return nil
555532}
556-
557- // registerNamespacedTools adds meta.* and query.* tools (namespaced variants).
558- //
559- //nolint:gocognit,funlen // ok for now
560- func registerNamespacedTools (server * mcp.Server , backend Backend , logger * logrus.Logger ) {
561- // meta.server_info
562- mcp .AddTool (
563- server ,
564- & mcp.Tool {
565- Name : "meta.server_info" ,
566- Description : "Namespaced: Get server information." ,
567- },
568- func (ctx context.Context , req * mcp.CallToolRequest , _ any ) (* mcp.CallToolResult , dto.ServerInfoDTO , error ) {
569- info , err := backend .ServerInfo (ctx , nil )
570- if err != nil {
571- return nil , dto.ServerInfoDTO {}, err
572- }
573- out := dto.ServerInfoDTO {Name : info .Name , Info : info .Info , IsReadOnly : info .IsReadOnly }
574- bytesOut , _ := json .Marshal (out )
575- return & mcp.CallToolResult {Content : []mcp.Content {& mcp.TextContent {Text : string (bytesOut )}}}, out , nil
576- },
577- )
578-
579- // meta.db_identity
580- mcp .AddTool (
581- server ,
582- & mcp.Tool {
583- Name : "meta.db_identity" ,
584- Description : "Namespaced: Get current database identity." ,
585- },
586- func (ctx context.Context , req * mcp.CallToolRequest , _ any ) (* mcp.CallToolResult , dto.DBIdentityDTO , error ) {
587- id , err := backend .DBIdentity (ctx , nil )
588- if err != nil {
589- return nil , dto.DBIdentityDTO {}, err
590- }
591- out := dto.DBIdentityDTO {Identity : fmt .Sprintf ("%v" , id ["identity" ])}
592- bytesOut , _ := json .Marshal (out )
593- return & mcp.CallToolResult {Content : []mcp.Content {& mcp.TextContent {Text : string (bytesOut )}}}, out , nil
594- },
595- )
596-
597- mcp .AddTool (
598- server ,
599- & mcp.Tool {
600- Name : "query.exec_text" ,
601- Description : "Namespaced: Execute SQL returning textual result." ,
602- },
603- func (ctx context.Context , req * mcp.CallToolRequest , arg dto.QueryInput ) (* mcp.CallToolResult , any , error ) {
604- logger .Infof ("query.exec_text SQL: %s" , arg .SQL )
605- rawText , err := backend .RunQuery (ctx , arg )
606- if err != nil {
607- return nil , nil , err
608- }
609- out := dto.QueryResultDTO {Raw : rawText , Format : "text" }
610- bytesOut , _ := json .Marshal (out )
611- return & mcp.CallToolResult {Content : []mcp.Content {& mcp.TextContent {Text : string (bytesOut )}}}, out , nil
612- },
613- )
614-
615- mcp .AddTool (
616- server ,
617- & mcp.Tool {
618- Name : "query.exec_json" ,
619- Description : "Namespaced: Execute SQL returning JSON array as text." ,
620- },
621- func (ctx context.Context , req * mcp.CallToolRequest , arg dto.QueryJSONInput ) (* mcp.CallToolResult , any , error ) {
622- rows , err := backend .RunQueryJSON (ctx , arg )
623- if err != nil {
624- return nil , nil , err
625- }
626- dtObj := dto.QueryResultDTO {
627- Rows : rows ,
628- RowCount : len (rows ),
629- Format : "json" ,
630- }
631- bytesOut , _ := json .Marshal (dtObj )
632- return & mcp.CallToolResult {Content : []mcp.Content {& mcp.TextContent {Text : string (bytesOut )}}}, dtObj , nil
633- },
634- )
635-
636- // meta_describe_table
637- mcp .AddTool (
638- server ,
639- & mcp.Tool {
640- Name : "meta_describe_table" ,
641- Description : "Describe a stackql relation. This publishes the bullk of the columns returned from a SELECT." ,
642- },
643- func (ctx context.Context , req * mcp.CallToolRequest , args dto.HierarchyInput ) (* mcp.CallToolResult , any , error ) {
644- result , err := backend .DescribeTable (ctx , args )
645- if err != nil {
646- return nil , nil , err
647- }
648- out := dto.QueryResultDTO {Rows : result , RowCount : len (result ), Format : "json" }
649- bytesOut , _ := json .Marshal (out )
650- return & mcp.CallToolResult {Content : []mcp.Content {& mcp.TextContent {Text : string (bytesOut )}}}, out , nil
651- },
652- )
653-
654- // meta.get_foreign_keys
655- mcp .AddTool (
656- server ,
657- & mcp.Tool {
658- Name : "meta.get_foreign_keys" ,
659- Description : "Namespaced: Get foreign keys for a table." ,
660- },
661- func (ctx context.Context , req * mcp.CallToolRequest , args dto.HierarchyInput ) (* mcp.CallToolResult , any , error ) {
662- result , err := backend .GetForeignKeys (ctx , args )
663- if err != nil {
664- return nil , nil , err
665- }
666- out := dto.QueryResultDTO {Rows : result , RowCount : len (result ), Format : "json" }
667- bytesOut , _ := json .Marshal (out )
668- return & mcp.CallToolResult {Content : []mcp.Content {& mcp.TextContent {Text : string (bytesOut )}}}, out , nil
669- },
670- )
671-
672- // meta.find_relationships
673- mcp .AddTool (
674- server ,
675- & mcp.Tool {
676- Name : "meta.find_relationships" ,
677- Description : "Namespaced: Find relationships for a table." ,
678- },
679- func (ctx context.Context , req * mcp.CallToolRequest , args dto.HierarchyInput ) (* mcp.CallToolResult , any , error ) {
680- result , err := backend .FindRelationships (ctx , args )
681- if err != nil {
682- return nil , nil , err
683- }
684- out := dto.SimpleTextDTO {Text : result }
685- bytesOut , _ := json .Marshal (out )
686- return & mcp.CallToolResult {Content : []mcp.Content {& mcp.TextContent {Text : string (bytesOut )}}}, out , nil
687- },
688- )
689- }
0 commit comments