Skip to content

Commit 075bd52

Browse files
committed
fix names
1 parent 5a96c2d commit 075bd52

File tree

2 files changed

+6
-9
lines changed

2 files changed

+6
-9
lines changed

Diff for: mcp_server/tools/create_http_application.py

+1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
from utils.request import post_slce_api
33
from tools import Tool, ABCTool, tools
44
from urllib.parse import urlparse
5+
56
@tools.register
67
class CreateHttpApplication(BaseModel, ABCTool):
78
domain: str = Field(default="",description="application domain, if empty, match all domain")

Diff for: mcp_server/tools/get_attack_events.py

+5-9
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
from pydantic import BaseModel, Field
22
from utils.request import get_slce_api
33
from tools import Tool, ABCTool, tools
4-
from urllib.parse import urlparse
4+
55
@tools.register
6-
class CreateHttpApplication(BaseModel, ABCTool):
6+
class GetAttackEvents(BaseModel, ABCTool):
77
ip: str = Field(default="", description="the attacker's client IP address")
88
size: int = Field(default=10, min=1, max=100, description="the number of results to return")
99
start: str = Field(default="", description="start time, millisecond timestamp")
@@ -12,13 +12,9 @@ class CreateHttpApplication(BaseModel, ABCTool):
1212
@classmethod
1313
async def run(self, arguments:dict) -> str:
1414
try:
15-
req = CreateHttpApplication.model_validate(arguments)
16-
parsed_upstream = urlparse(req.upstream)
17-
if parsed_upstream.scheme not in ["https", "http"]:
18-
return "invalid upstream scheme"
19-
20-
if parsed_upstream.hostname == "":
21-
return "invalid upstream host"
15+
req = GetAttackEvents.model_validate(arguments)
16+
if req.size < 1 or req.size > 100:
17+
return "size must be between 1 and 100"
2218
except Exception as e:
2319
return str(e)
2420

0 commit comments

Comments
 (0)