Skip to content

Commit e9559a5

Browse files
authored
Merge pull request #129 from IBM/fix-template-dir-for-version
Fix version template location in pip install
2 parents bac4c6e + 1ed3050 commit e9559a5

File tree

5 files changed

+12
-11
lines changed

5 files changed

+12
-11
lines changed

mcpgateway/admin.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -774,7 +774,7 @@ async def admin_add_gateway(request: Request, db: Session = Depends(get_db), use
774774
return RedirectResponse(f"{root_path}/admin#gateways", status_code=400)
775775
if isinstance(ex, RuntimeError):
776776
return RedirectResponse(f"{root_path}/admin#gateways", status_code=500)
777-
777+
778778
return RedirectResponse(f"{root_path}/admin#gateways", status_code=500)
779779

780780

mcpgateway/services/tool_service.py

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -495,19 +495,20 @@ async def invoke_tool(self, db: Session, name: str, arguments: Dict[str, Any]) -
495495

496496
# Build the payload based on integration type.
497497
payload = arguments.copy()
498-
498+
499499
# Handle URL path parameter substitution
500500
final_url = tool.url
501-
if '{' in tool.url and '}' in tool.url:
501+
if "{" in tool.url and "}" in tool.url:
502502
# Extract path parameters from URL template and arguments
503503
import re
504-
url_params = re.findall(r'\{(\w+)\}', tool.url)
504+
505+
url_params = re.findall(r"\{(\w+)\}", tool.url)
505506
url_substitutions = {}
506-
507+
507508
for param in url_params:
508509
if param in payload:
509510
url_substitutions[param] = payload.pop(param) # Remove from payload
510-
final_url = final_url.replace(f'{{{param}}}', str(url_substitutions[param]))
511+
final_url = final_url.replace(f"{{{param}}}", str(url_substitutions[param]))
511512
else:
512513
raise ToolInvocationError(f"Required URL parameter '{param}' not found in arguments")
513514

@@ -518,7 +519,7 @@ async def invoke_tool(self, db: Session, name: str, arguments: Dict[str, Any]) -
518519
else:
519520
response = await self._http_client.request(method, final_url, json=payload, headers=headers)
520521
response.raise_for_status()
521-
522+
522523
# Handle 204 No Content responses that have no body
523524
if response.status_code == 204:
524525
tool_result = ToolResult(content=[TextContent(type="text", text="Request completed successfully (No Content)")])

mcpgateway/static/admin.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -909,8 +909,8 @@ async function viewGateway(gatewayId) {
909909
<p><strong>Name:</strong> ${gateway.name}</p>
910910
<p><strong>URL:</strong> ${gateway.url}</p>
911911
<p><strong>Description:</strong> ${gateway.description || "N/A"}</p>
912-
<p><strong>Transport:</strong>
913-
${gateway.transport === "STREAMABLEHTTP" ? "Streamable HTTP" :
912+
<p><strong>Transport:</strong>
913+
${gateway.transport === "STREAMABLEHTTP" ? "Streamable HTTP" :
914914
gateway.transport === "SSE" ? "SSE" : "N/A"}
915915
</p>
916916
<p><strong>Status:</strong>

mcpgateway/templates/admin.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1758,7 +1758,7 @@ <h3 class="text-lg font-medium text-gray-900">Tool Details</h3>
17581758
</div>
17591759
</div>
17601760

1761-
1761+
17621762

17631763

17641764
<!-- Tool Edit Modal -->

mcpgateway/version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -396,7 +396,7 @@ async def version_endpoint(
396396
# Return partial HTML fragment for HTMX embedding
397397
from fastapi.templating import Jinja2Templates
398398

399-
templates = Jinja2Templates(directory="mcpgateway/templates")
399+
templates = Jinja2Templates(directory=str(settings.templates_dir))
400400
return templates.TemplateResponse("version_info_partial.html", {"request": request, "payload": payload})
401401
wants_html = fmt == "html" or "text/html" in request.headers.get("accept", "")
402402
if wants_html:

0 commit comments

Comments
 (0)