@@ -80,10 +80,41 @@ SELECT CUSTOMER_ID, CUSTOMER_NAME
8080FROM CUSTOMERS
8181WHERE STATE = ' CA'
8282```
83+ ## update_connx
84+ ``` python
85+ @mcp.tool ()
86+ async def update_connx (operation : str , query : str ) -> Dict[str , Any]:
87+ ```
88+ ## Purpose
89+ Executes data-modifying SQL statements (INSERT, UPDATE, DELETE) via CONNX.
90+
91+ ## Parameters
92+ • operation (str): One of insert, update, delete
93+ • query (str): Full SQL statement
94+
95+ ## Behavior
96+ • Validates the operation type before execution
97+ • Executes inside a transaction
98+ • Commits on success, rolls back on failure
99+
100+ ## Return format
101+ ``` python
102+ {
103+ " affected_rows" : 5 ,
104+ " message" : " Update completed successfully."
105+ }
106+ ```
107+ ## Example
108+ ``` sql
109+ UPDATE CUSTOMERS
110+ SET STATUS = ' INACTIVE'
111+ WHERE LAST_LOGIN < ' 2022-01-01'
112+ ```
113+
83114---
84115
85116## Integrate in MCP host config:
86- ``` python
117+ ``` json
87118@mcp.tool()
88119async def query_connx(query: str) -> Dict[str, Any]:
89120
@@ -106,7 +137,24 @@ Coverage includes connection handling, query/update execution, sanitization, and
106137 }
107138 }
108139```
140+
141+ ## Summary
142+ - query_connx is used for read-only SQL queries
143+ - update_connx is used for data modification
144+ - tools are asynchronous, safe, and testable
145+ - extending the toolset follows a simple, repeatable pattern
146+ - CI and test coverage protect against regressions
109147---
148+ ## Extending MCP Tools
149+
150+ Adding new tools is intentionally simple and testable.
151+
152+ General Pattern:
153+ 1 . Create a Python function
154+ 2 . Decorate it with @mcp .tool()
155+ 3 . Call existing helper functions (execute_query_async, execute_update_async)
156+ 4 . Return a JSON-serializable dictionary
157+
110158## Example: Add a count_connx Tool
111159
112160``` python
@@ -132,13 +180,4 @@ async def count_connx(table_name: str) -> Dict[str, Any]:
132180 " table" : " CUSTOMERS"
133181}
134182```
135- -- -
136- # # Extending MCP Tools
137183
138- Adding new tools is intentionally simple and testable.
139-
140- General Pattern:
141- 1 . Create a Python function
142- 2 . Decorate it with @ mcp.tool()
143- 3 . Call existing helper functions (execute_query_async, execute_update_async)
144- 4 . Return a JSON - serializable dictionary
0 commit comments