Skip to content

Commit c77cb69

Browse files
author
Suresh Kumar Moharajan
committed
add missing imports and remove redundant exception
Signed-off-by: Suresh Kumar Moharajan <suresh.kumar.m@ibm.com>
1 parent 9f1d4aa commit c77cb69

4 files changed

Lines changed: 4 additions & 16 deletions

File tree

mcpgateway/main.py

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -2364,20 +2364,6 @@ async def plugin_exception_handler(_request: Request, exc: PluginError):
23642364
return ORJSONResponse(status_code=200, content={"error": json_rpc_error.model_dump()})
23652365

23662366

2367-
@app.exception_handler(ContentSizeError)
2368-
async def content_size_exception_handler(_request: Request, exc: ContentSizeError):
2369-
"""Handle content size limit violations globally.
2370-
2371-
Args:
2372-
_request: The incoming request (unused, required by FastAPI handler interface).
2373-
exc: The ContentSizeError with actual_size, max_size, and content_type.
2374-
2375-
Returns:
2376-
ORJSONResponse: A 413 Payload Too Large response with structured error details.
2377-
"""
2378-
return ORJSONResponse(status_code=413, content={"detail": {"error": f"{exc.content_type} size limit exceeded", "message": str(exc), "actual_size": exc.actual_size, "max_size": exc.max_size}})
2379-
2380-
23812367
@app.exception_handler(ContentTypeError)
23822368
async def content_type_exception_handler(_request: Request, exc: ContentTypeError):
23832369
"""Handle MIME type validation failures globally.

mcpgateway/services/content_security.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,11 +29,11 @@
2929
class NoOpCounter:
3030
"""No-op counter for test environments where metrics are unavailable."""
3131

32-
def labels(self, **kwargs):
32+
def labels(self, **_kwargs):
3333
"""Return self to allow method chaining."""
3434
return self
3535

36-
def inc(self, amount=1):
36+
def inc(self, _amount=1):
3737
"""No-op increment method."""
3838

3939
content_size_violations_counter = NoOpCounter()

mcpgateway/services/prompt_service.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@
4747
from mcpgateway.plugins.framework import get_plugin_manager, GlobalContext, PluginContextTable, PluginManager, PromptHookType, PromptPosthookPayload, PromptPrehookPayload
4848
from mcpgateway.schemas import PromptCreate, PromptMetrics, PromptRead, PromptUpdate, TopPerformer
4949
from mcpgateway.services.audit_trail_service import get_audit_trail_service
50+
from mcpgateway.services.base_service import BaseService
5051
from mcpgateway.services.content_security import ContentSizeError, get_content_security_service
5152
from mcpgateway.services.event_service import EventService
5253
from mcpgateway.services.logging_service import LoggingService

mcpgateway/services/resource_service.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@
6060
from mcpgateway.observability import create_span
6161
from mcpgateway.schemas import ResourceCreate, ResourceMetrics, ResourceRead, ResourceSubscription, ResourceUpdate, TopPerformer
6262
from mcpgateway.services.audit_trail_service import get_audit_trail_service
63+
from mcpgateway.services.base_service import BaseService
6364
from mcpgateway.services.content_security import ContentSizeError, ContentTypeError, get_content_security_service
6465
from mcpgateway.services.event_service import EventService
6566
from mcpgateway.services.logging_service import LoggingService

0 commit comments

Comments
 (0)