@@ -47,6 +47,9 @@ func getConn(connectionString string) (*dgo.Dgraph, error) {
4747 return conn , nil
4848}
4949
50+ var True = true
51+ var False = false
52+
5053// NewMCPServer initializes and returns a new MCPServer instance.
5154func NewMCPServer (connectionString string , readOnly bool ) (* server.MCPServer , error ) {
5255 s := server .NewMCPServer (
@@ -60,10 +63,10 @@ func NewMCPServer(connectionString string, readOnly bool) (*server.MCPServer, er
6063 schemaTool := mcp .NewTool ("Get-Schema" ,
6164 mcp .WithDescription ("Get Dgraph DQL Schema from dgraph db" ),
6265 mcp .WithToolAnnotation (mcp.ToolAnnotation {
63- ReadOnlyHint : true ,
64- DestructiveHint : false ,
65- IdempotentHint : true ,
66- OpenWorldHint : false ,
66+ ReadOnlyHint : & True ,
67+ DestructiveHint : & False ,
68+ IdempotentHint : & True ,
69+ OpenWorldHint : & False ,
6770 }),
6871 )
6972
@@ -74,10 +77,10 @@ func NewMCPServer(connectionString string, readOnly bool) (*server.MCPServer, er
7477 mcp .Description ("The query to perform" ),
7578 ),
7679 mcp .WithToolAnnotation (mcp.ToolAnnotation {
77- ReadOnlyHint : true ,
78- DestructiveHint : false ,
79- IdempotentHint : true ,
80- OpenWorldHint : false ,
80+ ReadOnlyHint : & True ,
81+ DestructiveHint : & False ,
82+ IdempotentHint : & True ,
83+ OpenWorldHint : & False ,
8184 }),
8285 )
8386
@@ -89,15 +92,15 @@ func NewMCPServer(connectionString string, readOnly bool) (*server.MCPServer, er
8992 mcp .Description ("Updated schema to insert inside the db" ),
9093 ),
9194 mcp .WithToolAnnotation (mcp.ToolAnnotation {
92- ReadOnlyHint : false ,
93- DestructiveHint : true ,
94- IdempotentHint : false ,
95- OpenWorldHint : false ,
95+ ReadOnlyHint : & False ,
96+ DestructiveHint : & True ,
97+ IdempotentHint : & False ,
98+ OpenWorldHint : & False ,
9699 }),
97100 )
98101
99102 s .AddTool (alterSchemaTool , func (ctx context.Context , request mcp.CallToolRequest ) (* mcp.CallToolResult , error ) {
100- schema , ok := request .Params . Arguments ["schema" ].(string )
103+ schema , ok := request .GetArguments () ["schema" ].(string )
101104 if ! ok {
102105 return nil , fmt .Errorf ("schema must be present" )
103106 }
@@ -121,10 +124,10 @@ func NewMCPServer(connectionString string, readOnly bool) (*server.MCPServer, er
121124 mcp .Description ("The mutation to perform in json format" ),
122125 ),
123126 mcp .WithToolAnnotation (mcp.ToolAnnotation {
124- ReadOnlyHint : false ,
125- DestructiveHint : true ,
126- IdempotentHint : false ,
127- OpenWorldHint : false ,
127+ ReadOnlyHint : & False ,
128+ DestructiveHint : & True ,
129+ IdempotentHint : & False ,
130+ OpenWorldHint : & False ,
128131 }),
129132 )
130133
@@ -140,7 +143,7 @@ func NewMCPServer(connectionString string, readOnly bool) (*server.MCPServer, er
140143 glog .Errorf ("failed to discard transaction: %v" , err )
141144 }
142145 }()
143- mutation , ok := request .Params . Arguments ["mutation" ].(string )
146+ mutation , ok := request .GetArguments () ["mutation" ].(string )
144147 if ! ok {
145148 return nil , fmt .Errorf ("mutation must present" )
146149 }
@@ -167,7 +170,7 @@ func NewMCPServer(connectionString string, readOnly bool) (*server.MCPServer, er
167170 glog .Errorf ("failed to discard transaction: %v" , err )
168171 }
169172 }()
170- op := request .Params . Arguments ["query" ].(string )
173+ op := request .GetArguments () ["query" ].(string )
171174 resp , err := txn .Query (ctx , op )
172175 if err != nil {
173176 return mcp .NewToolResultError (err .Error ()), nil
@@ -224,10 +227,10 @@ func NewMCPServer(connectionString string, readOnly bool) (*server.MCPServer, er
224227 commonQueriesTool := mcp .NewTool ("Get-Common-Queries" ,
225228 mcp .WithDescription ("Get common queries that you can run on the db. If you are seeing issues with your queries, you can check this tool once." ),
226229 mcp .WithToolAnnotation (mcp.ToolAnnotation {
227- ReadOnlyHint : true ,
228- DestructiveHint : false ,
229- IdempotentHint : true ,
230- OpenWorldHint : false ,
230+ ReadOnlyHint : & True ,
231+ DestructiveHint : & False ,
232+ IdempotentHint : & True ,
233+ OpenWorldHint : & False ,
231234 }),
232235 )
233236
0 commit comments