Skip to content

Commit 8a655d0

Browse files
authored
Unify delete tools (#48)
1 parent f882653 commit 8a655d0

21 files changed

+66
-354
lines changed

.github/workflows/release.yml

+3
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ jobs:
3636
- name: Get version from main
3737
id: get-main-version
3838
run: |
39+
source .venv/bin/activate
3940
git switch main
4041
MAIN_VERSION=$(python -c "import toml; print(toml.load('pyproject.toml')['project']['version'])")
4142
echo "MAIN_VERSION=$MAIN_VERSION" >> $GITHUB_ENV
@@ -44,6 +45,7 @@ jobs:
4445
- name: Compare versions
4546
id: compare-versions
4647
run: |
48+
source .venv/bin/activate
4749
CUR_VERSION=$(python -c "import toml; print(toml.load('pyproject.toml')['project']['version'])")
4850
4951
echo "Current version in pyproject.toml: $CUR_VERSION"
@@ -55,6 +57,7 @@ jobs:
5557
else
5658
echo "Versions differ. Proceed with the release."
5759
echo "SKIP_RELEASE=false" >> $GITHUB_ENV
60+
fi
5861
5962
- name: Release to PyPI
6063
if: env.SKIP_RELEASE != 'true'

CHANGELOG.md

+1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
### Enhancements
44

55
- Duplicated description of the custom workflow was removed from the tools, freeing up tokens from the LLM.
6+
- **Delete Connector Tools Unification**: All delete tools require just the ID of the connector, so they were combined into one tool for sources and one for destinations.
67

78
### Fixes
89

pyproject.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[project]
22
name = "uns_mcp"
3-
version = "0.1.2.2" # Set only non-dev versions to release. Setting extra .2 as 0.1.2 was already released and the name if locked forever. During next release point to 0.1.3
3+
version = "0.1.2.3" # Set only non-dev versions to release. Setting extra .2 as 0.1.2 was already released and the name if locked forever. During next release point to 0.1.3
44
description = "MCP server implementation providing structured tools for interacting with the Unstructured API, managing sources, destinations, workflows, and jobs"
55
requires-python = ">=3.12"
66
readme = "README.md"

uns_mcp/connectors/destination/__init__.py

+9-35
Original file line numberDiff line numberDiff line change
@@ -3,80 +3,54 @@
33

44
def register_destination_connectors(mcp: FastMCP):
55
"""Register all destination connector tools with the MCP server."""
6-
from .astra import (
7-
create_astradb_destination,
8-
delete_astradb_destination,
9-
update_astradb_destination,
6+
from connectors.destination.mongo import (
7+
create_mongodb_destination,
8+
update_mongodb_destination,
109
)
10+
11+
from .astra import create_astradb_destination, update_astradb_destination
1112
from .databricks_vdt import (
1213
create_databricks_delta_table_destination,
13-
delete_databricks_delta_table_destination,
1414
update_databricks_delta_table_destination,
1515
)
1616
from .databricksvolumes import (
1717
create_databricks_volumes_destination,
18-
delete_databricks_volumes_destination,
1918
update_databricks_volumes_destination,
2019
)
21-
from .mongo import (
22-
create_mongodb_destination,
23-
delete_mongodb_destination,
24-
update_mongodb_destination,
25-
)
26-
from .neo4j import (
27-
create_neo4j_destination,
28-
delete_neo4j_destination,
29-
update_neo4j_destination,
30-
)
31-
from .pinecone import (
32-
create_pinecone_destination,
33-
delete_pinecone_destination,
34-
update_pinecone_destination,
35-
)
36-
from .s3 import create_s3_destination, delete_s3_destination, update_s3_destination
37-
from .weaviate import (
38-
create_weaviate_destination,
39-
delete_weaviate_destination,
40-
update_weaviate_destination,
41-
)
20+
from .neo4j import create_neo4j_destination, update_neo4j_destination
21+
from .pinecone import create_pinecone_destination, update_pinecone_destination
22+
from .s3 import create_s3_destination, update_s3_destination
23+
from .weaviate import create_weaviate_destination, update_weaviate_destination
4224

4325
# Register S3 destination connector tools
4426
mcp.tool()(create_s3_destination)
4527
mcp.tool()(update_s3_destination)
46-
mcp.tool()(delete_s3_destination)
4728

4829
# Register Weaviate destination connector tools
4930
mcp.tool()(create_weaviate_destination)
5031
mcp.tool()(update_weaviate_destination)
51-
mcp.tool()(delete_weaviate_destination)
5232

5333
# Register AstraDB destination connector tools
5434
mcp.tool()(create_astradb_destination)
5535
mcp.tool()(update_astradb_destination)
56-
mcp.tool()(delete_astradb_destination)
5736

5837
# Register Neo4j destination connector tools
5938
mcp.tool()(create_neo4j_destination)
6039
mcp.tool()(update_neo4j_destination)
61-
mcp.tool()(delete_neo4j_destination)
6240

6341
# Register MongoDB destination connector tools
6442
mcp.tool()(create_mongodb_destination)
6543
mcp.tool()(update_mongodb_destination)
66-
mcp.tool()(delete_mongodb_destination)
6744

6845
# Register databricks destination connector tools
6946
mcp.tool()(create_databricks_volumes_destination)
7047
mcp.tool()(update_databricks_volumes_destination)
71-
mcp.tool()(delete_databricks_volumes_destination)
7248

7349
# Register databricks delta table destination connector tools
7450
mcp.tool()(create_databricks_delta_table_destination)
7551
mcp.tool()(update_databricks_delta_table_destination)
76-
mcp.tool()(delete_databricks_delta_table_destination)
7752

7853
# Register Pinecone destination connector tools
7954

8055
mcp.tool()(create_pinecone_destination)
8156
mcp.tool()(update_pinecone_destination)
82-
mcp.tool()(delete_pinecone_destination)

uns_mcp/connectors/destination/astra.py

-21
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
from mcp.server.fastmcp import Context
66
from unstructured_client.models.operations import (
77
CreateDestinationRequest,
8-
DeleteDestinationRequest,
98
GetDestinationRequest,
109
UpdateDestinationRequest,
1110
)
@@ -188,23 +187,3 @@ async def update_astradb_destination(
188187
return result
189188
except Exception as e:
190189
return f"Error updating AstraDB destination connector: {str(e)}"
191-
192-
193-
async def delete_astradb_destination(ctx: Context, destination_id: str) -> str:
194-
"""Delete an AstraDB destination connector.
195-
196-
Args:
197-
destination_id: ID of the destination connector to delete
198-
199-
Returns:
200-
String containing the result of the deletion
201-
"""
202-
client = ctx.request_context.lifespan_context.client
203-
204-
try:
205-
_ = await client.destinations.delete_destination_async(
206-
request=DeleteDestinationRequest(destination_id=destination_id),
207-
)
208-
return f"AstraDB Destination Connector with ID {destination_id} deleted successfully"
209-
except Exception as e:
210-
return f"Error deleting AstraDB destination connector: {str(e)}"

uns_mcp/connectors/destination/databricks_vdt.py

-22
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
from mcp.server.fastmcp import Context
55
from unstructured_client.models.operations import (
66
CreateDestinationRequest,
7-
DeleteDestinationRequest,
87
GetDestinationRequest,
98
UpdateDestinationRequest,
109
)
@@ -195,24 +194,3 @@ async def update_databricks_delta_table_destination(
195194
return result
196195
except Exception as e:
197196
return f"Error updating databricks volumes Delta Table destination connector: {str(e)}"
198-
199-
200-
async def delete_databricks_delta_table_destination(ctx: Context, destination_id: str) -> str:
201-
"""Delete an databricks volumes destination connector.
202-
203-
Args:
204-
destination_id: ID of the destination connector to delete
205-
206-
Returns:
207-
String containing the result of the deletion
208-
"""
209-
client = ctx.request_context.lifespan_context.client
210-
211-
try:
212-
_ = await client.destinations.delete_destination_async(
213-
request=DeleteDestinationRequest(destination_id=destination_id),
214-
)
215-
return f"Databricks volumes Delta Table Destination Connector with ID {destination_id} \
216-
deleted successfully"
217-
except Exception as e:
218-
return f"Error deleting Databricks volumes Delta Table destination connector: {str(e)}"

uns_mcp/connectors/destination/databricksvolumes.py

-22
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
from mcp.server.fastmcp import Context
55
from unstructured_client.models.operations import (
66
CreateDestinationRequest,
7-
DeleteDestinationRequest,
87
GetDestinationRequest,
98
UpdateDestinationRequest,
109
)
@@ -165,24 +164,3 @@ async def update_databricks_volumes_destination(
165164
return result
166165
except Exception as e:
167166
return f"Error updating databricks volumes destination connector: {str(e)}"
168-
169-
170-
async def delete_databricks_volumes_destination(ctx: Context, destination_id: str) -> str:
171-
"""Delete an databricks volumes destination connector.
172-
173-
Args:
174-
destination_id: ID of the destination connector to delete
175-
176-
Returns:
177-
String containing the result of the deletion
178-
"""
179-
client = ctx.request_context.lifespan_context.client
180-
181-
try:
182-
_ = await client.destinations.delete_destination_async(
183-
request=DeleteDestinationRequest(destination_id=destination_id),
184-
)
185-
return f"Databricks volumes Destination Connector with ID {destination_id} \
186-
deleted successfully"
187-
except Exception as e:
188-
return f"Error deleting Databricks volumes destination connector: {str(e)}"
+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
from mcp.server.fastmcp import Context
2+
from unstructured_client.models.operations import DeleteDestinationRequest
3+
4+
5+
async def delete_destination(ctx: Context, destination_id: str) -> str:
6+
"""Delete a destination connector.
7+
8+
Args:
9+
destination_id: ID of the destination connector to delete
10+
11+
Returns:
12+
String containing the result of the deletion
13+
"""
14+
client = ctx.request_context.lifespan_context.client
15+
16+
try:
17+
_ = await client.destinations.delete_destination_async(
18+
request=DeleteDestinationRequest(destination_id=destination_id),
19+
)
20+
return f"Destination Connector with ID {destination_id} deleted successfully"
21+
except Exception as e:
22+
return f"Error deleting destination connector: {str(e)}"

uns_mcp/connectors/destination/mongo.py

-21
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
from mcp.server.fastmcp import Context
55
from unstructured_client.models.operations import (
66
CreateDestinationRequest,
7-
DeleteDestinationRequest,
87
GetDestinationRequest,
98
UpdateDestinationRequest,
109
)
@@ -126,23 +125,3 @@ async def update_mongodb_destination(
126125
return result
127126
except Exception as e:
128127
return f"Error updating MongoDB destination connector: {str(e)}"
129-
130-
131-
async def delete_mongodb_destination(ctx: Context, destination_id: str) -> str:
132-
"""Delete an MongoDB destination connector.
133-
134-
Args:
135-
destination_id: ID of the destination connector to delete
136-
137-
Returns:
138-
String containing the result of the deletion
139-
"""
140-
client = ctx.request_context.lifespan_context.client
141-
142-
try:
143-
_ = await client.destinations.delete_destination_async(
144-
request=DeleteDestinationRequest(destination_id=destination_id),
145-
)
146-
return f"MongoDB Destination Connector with ID {destination_id} deleted successfully"
147-
except Exception as e:
148-
return f"Error deleting MongoDB destination connector: {str(e)}"

uns_mcp/connectors/destination/neo4j.py

-21
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
from mcp.server.fastmcp import Context
55
from unstructured_client.models.operations import (
66
CreateDestinationRequest,
7-
DeleteDestinationRequest,
87
GetDestinationRequest,
98
UpdateDestinationRequest,
109
)
@@ -138,23 +137,3 @@ async def update_neo4j_destination(
138137
return result
139138
except Exception as e:
140139
return f"Error updating neo4j destination connector: {str(e)}"
141-
142-
143-
async def delete_neo4j_destination(ctx: Context, destination_id: str) -> str:
144-
"""Delete an neo4j destination connector.
145-
146-
Args:
147-
destination_id: ID of the destination connector to delete
148-
149-
Returns:
150-
String containing the result of the deletion
151-
"""
152-
client = ctx.request_context.lifespan_context.client
153-
154-
try:
155-
_ = await client.destinations.delete_destination_async(
156-
request=DeleteDestinationRequest(destination_id=destination_id),
157-
)
158-
return f"neo4j Destination Connector with ID {destination_id} deleted successfully"
159-
except Exception as e:
160-
return f"Error deleting neo4j destination connector: {str(e)}"

uns_mcp/connectors/destination/pinecone.py

-21
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
from mcp.server.fastmcp import Context
55
from unstructured_client.models.operations import (
66
CreateDestinationRequest,
7-
DeleteDestinationRequest,
87
GetDestinationRequest,
98
UpdateDestinationRequest,
109
)
@@ -140,23 +139,3 @@ async def update_pinecone_destination(
140139
return result
141140
except Exception as e:
142141
return f"Error updating pinecone destination connector: {str(e)}"
143-
144-
145-
async def delete_pinecone_destination(ctx: Context, destination_id: str) -> str:
146-
"""Delete an pinecone destination connector.
147-
148-
Args:
149-
destination_id: ID of the destination connector to delete
150-
151-
Returns:
152-
String containing the result of the deletion
153-
"""
154-
client = ctx.request_context.lifespan_context.client
155-
156-
try:
157-
_ = await client.destinations.delete_destination_async(
158-
request=DeleteDestinationRequest(destination_id=destination_id),
159-
)
160-
return f"Pinecone Destination Connector with ID {destination_id} deleted successfully"
161-
except Exception as e:
162-
return f"Error deleting Pinecone destination connector: {str(e)}"

uns_mcp/connectors/destination/s3.py

-21
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
from mcp.server.fastmcp import Context
55
from unstructured_client.models.operations import (
66
CreateDestinationRequest,
7-
DeleteDestinationRequest,
87
GetDestinationRequest,
98
UpdateDestinationRequest,
109
)
@@ -133,23 +132,3 @@ async def update_s3_destination(
133132
return result
134133
except Exception as e:
135134
return f"Error updating S3 destination connector: {str(e)}"
136-
137-
138-
async def delete_s3_destination(ctx: Context, destination_id: str) -> str:
139-
"""Delete an S3 destination connector.
140-
141-
Args:
142-
destination_id: ID of the destination connector to delete
143-
144-
Returns:
145-
String containing the result of the deletion
146-
"""
147-
client = ctx.request_context.lifespan_context.client
148-
149-
try:
150-
_ = await client.destinations.delete_destination_async(
151-
request=DeleteDestinationRequest(destination_id=destination_id),
152-
)
153-
return f"S3 Destination Connector with ID {destination_id} deleted successfully"
154-
except Exception as e:
155-
return f"Error deleting S3 destination connector: {str(e)}"

0 commit comments

Comments
 (0)