Skip to content

Commit 9c53599

Browse files
committed
Remove trailing '/' if it exists
1 parent 5c8f404 commit 9c53599

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

cratedb_mcp/__main__.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,12 @@
1414

1515

1616
def query_cratedb(query: str) -> list[dict]:
17-
return httpx.post(
18-
f"{HTTP_URL}/_sql", json={"stmt": query}, timeout=Settings.http_timeout()
19-
).json()
17+
"""Sends a `query` to the set `$CRATEDB_CLUSTER_URL`"""
18+
url = HTTP_URL
19+
if url.endswith("/"):
20+
url = url.removesuffix("/")
21+
22+
return httpx.post(f"{url}/_sql", json={"stmt": query}, timeout=Settings.http_timeout()).json()
2023

2124

2225
@mcp.tool(

0 commit comments

Comments
 (0)