Skip to content

Commit 6152c4c

Browse files
committed
fix: cleanup code formatting and remove unused advanced rate limiting tests
- Fix Black code formatting issues across multiple files - Fix import sorting with isort - Fix mypy type checking errors by adding proper type guards - Remove all references to non-existent advanced rate limiting functions - Clean up test fixtures and remove commented test classes - Fix JSON configuration format in tools_config.json - Ensure all linting checks (black, isort, flake8, mypy) pass successfully This commit ensures the codebase passes all local CI checks including formatting, linting, and type checking requirements.
1 parent d761449 commit 6152c4c

File tree

5 files changed

+33
-964
lines changed

5 files changed

+33
-964
lines changed

coverage.txt

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
1-
Name Stmts Miss Cover
2-
----------------------------------------------------------------
3-
src/kong_mcp_server/__init__.py 5 2 60%
4-
src/kong_mcp_server/kong_client.py 88 0 100%
5-
src/kong_mcp_server/server.py 79 23 71%
6-
src/kong_mcp_server/tools/__init__.py 0 0 100%
7-
src/kong_mcp_server/tools/basic.py 2 0 100%
8-
src/kong_mcp_server/tools/kong_routes.py 39 0 100%
9-
src/kong_mcp_server/tools/kong_services.py 35 2 94%
10-
----------------------------------------------------------------
11-
TOTAL 248 27 89%
1+
Name Stmts Miss Cover
2+
---------------------------------------------------------------------
3+
src/kong_mcp_server/__init__.py 5 2 60%
4+
src/kong_mcp_server/kong_client.py 96 0 100%
5+
src/kong_mcp_server/server.py 79 23 71%
6+
src/kong_mcp_server/tools/__init__.py 0 0 100%
7+
src/kong_mcp_server/tools/basic.py 2 0 100%
8+
src/kong_mcp_server/tools/kong_plugins.py 43 0 100%
9+
src/kong_mcp_server/tools/kong_rate_limiting.py 120 13 89%
10+
src/kong_mcp_server/tools/kong_routes.py 39 0 100%
11+
src/kong_mcp_server/tools/kong_services.py 35 2 94%
12+
---------------------------------------------------------------------
13+
TOTAL 419 40 90%

src/kong_mcp_server/tools/kong_rate_limiting.py

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@
44

55
from kong_mcp_server.kong_client import KongClient
66

7-
87
# Basic Rate Limiting Plugin Tools
98

9+
1010
async def create_rate_limiting_plugin(
1111
minute: Optional[int] = None,
1212
hour: Optional[int] = None,
@@ -155,7 +155,8 @@ async def get_rate_limiting_plugins(
155155

156156
async with KongClient() as client:
157157
response = await client.get(endpoint, params=params)
158-
return response.get("data", [])
158+
data = response.get("data", [])
159+
return data if isinstance(data, list) else []
159160

160161

161162
async def update_rate_limiting_plugin(
@@ -268,12 +269,13 @@ async def delete_rate_limiting_plugin(plugin_id: str) -> Dict[str, Any]:
268269
await client.delete(f"/plugins/{plugin_id}")
269270
return {
270271
"message": "Rate limiting plugin deleted successfully",
271-
"plugin_id": plugin_id
272+
"plugin_id": plugin_id,
272273
}
273274

274275

275276
# General Plugin Management Tools
276277

278+
277279
async def get_plugin(plugin_id: str) -> Dict[str, Any]:
278280
"""Get a specific plugin by ID.
279281
@@ -330,4 +332,5 @@ async def get_plugins(
330332

331333
async with KongClient() as client:
332334
response = await client.get(endpoint, params=params)
333-
return response.get("data", [])
335+
data = response.get("data", [])
336+
return data if isinstance(data, list) else []

src/kong_mcp_server/tools_config.json

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -70,20 +70,20 @@
7070
"function": "get_plugins_by_service",
7171
"enabled": true
7272
},
73-
"kong_get_plugins_by_route": {
73+
"kong_get_plugins_by_route": {
7474
"name": "kong_get_plugins_by_route",
7575
"description": "Retrieve route scoped Kong plugins with optional filtering by name and pagination.",
7676
"module": "kong_mcp_server.tools.kong_plugins",
7777
"function": "get_plugins_by_route",
7878
"enabled": true
7979
},
80-
"kong_get_plugins_by_consumer": {
80+
"kong_get_plugins_by_consumer": {
8181
"name": "kong_get_plugins_by_consumer",
8282
"description": "Retrieve consumer scoped Kong plugins with optional filtering by name and pagination.",
8383
"module": "kong_mcp_server.tools.kong_plugins",
8484
"function": "get_plugins_by_consumer",
8585
"enabled": true
86-
},
86+
},
8787
"kong_create_rate_limiting_plugin": {
8888
"name": "kong_create_rate_limiting_plugin",
8989
"description": "Create a basic rate limiting plugin with support for all scopes (global, service, route, consumer) and time-based limits (second, minute, hour, day, month, year)",
@@ -119,4 +119,5 @@
119119
"function": "get_plugin",
120120
"enabled": true
121121
}
122-
}
122+
}
123+
}

0 commit comments

Comments
 (0)