Skip to content

Commit acc3ba2

Browse files
author
Rakesh Goyal
authored
Replaced hyphen with underscore in the tool names
1 parent 25d1a1c commit acc3ba2

File tree

1 file changed

+21
-21
lines changed

1 file changed

+21
-21
lines changed

src/sqlite/src/mcp_server_sqlite/server.py

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -27,12 +27,12 @@
2727
This server exposes one key resource: "memo://insights", which is a business insights memo that gets automatically updated throughout the analysis process. As users analyze the database and discover insights, the memo resource gets updated in real-time to reflect new findings. Resources act as living documents that provide context to the conversation.
2828
Tools:
2929
This server provides several SQL-related tools:
30-
"read-query": Executes SELECT queries to read data from the database
31-
"write-query": Executes INSERT, UPDATE, or DELETE queries to modify data
32-
"create-table": Creates new tables in the database
33-
"list-tables": Shows all existing tables
34-
"describe-table": Shows the schema for a specific table
35-
"append-insight": Adds a new business insight to the memo resource
30+
"read_query": Executes SELECT queries to read data from the database
31+
"write_query": Executes INSERT, UPDATE, or DELETE queries to modify data
32+
"create_table": Creates new tables in the database
33+
"list_tables": Shows all existing tables
34+
"describe_table": Shows the schema for a specific table
35+
"append_insight": Adds a new business insight to the memo resource
3636
</mcp>
3737
<demo-instructions>
3838
You are an AI assistant tasked with generating a comprehensive business scenario based on a given topic.
@@ -68,7 +68,7 @@
6868
b. Explain the purpose of each query option.
6969
c. Wait for the user to select one of the query options.
7070
d. After each query be sure to opine on the results.
71-
e. Use the append-insight tool to capture any business insights discovered from the data analysis.
71+
e. Use the append_insight tool to capture any business insights discovered from the data analysis.
7272
7373
7. Generate a dashboard:
7474
a. Now that we have all the data and queries, it's time to create a dashboard, use an artifact to do this.
@@ -233,7 +233,7 @@ async def handle_list_tools() -> list[types.Tool]:
233233
"""List available tools"""
234234
return [
235235
types.Tool(
236-
name="read-query",
236+
name="read_query",
237237
description="Execute a SELECT query on the SQLite database",
238238
inputSchema={
239239
"type": "object",
@@ -244,7 +244,7 @@ async def handle_list_tools() -> list[types.Tool]:
244244
},
245245
),
246246
types.Tool(
247-
name="write-query",
247+
name="write_query",
248248
description="Execute an INSERT, UPDATE, or DELETE query on the SQLite database",
249249
inputSchema={
250250
"type": "object",
@@ -255,7 +255,7 @@ async def handle_list_tools() -> list[types.Tool]:
255255
},
256256
),
257257
types.Tool(
258-
name="create-table",
258+
name="create_table",
259259
description="Create a new table in the SQLite database",
260260
inputSchema={
261261
"type": "object",
@@ -266,15 +266,15 @@ async def handle_list_tools() -> list[types.Tool]:
266266
},
267267
),
268268
types.Tool(
269-
name="list-tables",
269+
name="list_tables",
270270
description="List all tables in the SQLite database",
271271
inputSchema={
272272
"type": "object",
273273
"properties": {},
274274
},
275275
),
276276
types.Tool(
277-
name="describe-table",
277+
name="describe_table",
278278
description="Get the schema information for a specific table",
279279
inputSchema={
280280
"type": "object",
@@ -285,7 +285,7 @@ async def handle_list_tools() -> list[types.Tool]:
285285
},
286286
),
287287
types.Tool(
288-
name="append-insight",
288+
name="append_insight",
289289
description="Add a business insight to the memo",
290290
inputSchema={
291291
"type": "object",
@@ -303,21 +303,21 @@ async def handle_call_tool(
303303
) -> list[types.TextContent | types.ImageContent | types.EmbeddedResource]:
304304
"""Handle tool execution requests"""
305305
try:
306-
if name == "list-tables":
306+
if name == "list_tables":
307307
results = db._execute_query(
308308
"SELECT name FROM sqlite_master WHERE type='table'"
309309
)
310310
return [types.TextContent(type="text", text=str(results))]
311311

312-
elif name == "describe-table":
312+
elif name == "describe_table":
313313
if not arguments or "table_name" not in arguments:
314314
raise ValueError("Missing table_name argument")
315315
results = db._execute_query(
316316
f"PRAGMA table_info({arguments['table_name']})"
317317
)
318318
return [types.TextContent(type="text", text=str(results))]
319319

320-
elif name == "append-insight":
320+
elif name == "append_insight":
321321
if not arguments or "insight" not in arguments:
322322
raise ValueError("Missing insight argument")
323323

@@ -332,19 +332,19 @@ async def handle_call_tool(
332332
if not arguments:
333333
raise ValueError("Missing arguments")
334334

335-
if name == "read-query":
335+
if name == "read_query":
336336
if not arguments["query"].strip().upper().startswith("SELECT"):
337-
raise ValueError("Only SELECT queries are allowed for read-query")
337+
raise ValueError("Only SELECT queries are allowed for read_query")
338338
results = db._execute_query(arguments["query"])
339339
return [types.TextContent(type="text", text=str(results))]
340340

341-
elif name == "write-query":
341+
elif name == "write_query":
342342
if arguments["query"].strip().upper().startswith("SELECT"):
343-
raise ValueError("SELECT queries are not allowed for write-query")
343+
raise ValueError("SELECT queries are not allowed for write_query")
344344
results = db._execute_query(arguments["query"])
345345
return [types.TextContent(type="text", text=str(results))]
346346

347-
elif name == "create-table":
347+
elif name == "create_table":
348348
if not arguments["query"].strip().upper().startswith("CREATE TABLE"):
349349
raise ValueError("Only CREATE TABLE statements are allowed")
350350
db._execute_query(arguments["query"])

0 commit comments

Comments
 (0)