SimpleSallap:SimpleMCP:SendMcp expects dataclass and uses asdict
This commit is contained in:
parent
bc9dd580b9
commit
f75f93f8d9
|
|
@ -19,12 +19,14 @@ import ssl
|
|||
import traceback
|
||||
import json
|
||||
from typing import Any
|
||||
from dataclasses import asdict
|
||||
import tcpdf as mTCPdf
|
||||
import tcweb as mTCWeb
|
||||
import toolcall as mTC
|
||||
import config as mConfig
|
||||
|
||||
|
||||
|
||||
gMe = mConfig.Config()
|
||||
|
||||
|
||||
|
|
@ -92,7 +94,8 @@ class ProxyHandler(http.server.BaseHTTPRequestHandler):
|
|||
# Add CORS for browser fetch, just in case
|
||||
self.send_header('Access-Control-Allow-Origin', '*')
|
||||
self.end_headers()
|
||||
self.wfile.write(json.dumps(body).encode('utf-8'))
|
||||
data = asdict(body)
|
||||
self.wfile.write(json.dumps(data).encode('utf-8'))
|
||||
|
||||
def mcp_toolscall(self, oRPC: Any):
|
||||
"""
|
||||
|
|
|
|||
|
|
@ -111,9 +111,11 @@ class ToolCall():
|
|||
return ToolCallMeta("function", tcf)
|
||||
|
||||
|
||||
MCPTLTools: TypeAlias = list[ToolCallMeta]
|
||||
|
||||
@dataclass
|
||||
class MCPTLResult:
|
||||
tools: list[ToolCallMeta]
|
||||
tools: MCPTLTools
|
||||
|
||||
@dataclass
|
||||
class MCPToolsList:
|
||||
|
|
@ -131,7 +133,7 @@ class ToolManager():
|
|||
self.toolcalls[fName] = tc
|
||||
|
||||
def meta(self):
|
||||
lMeta: list[ToolCallMeta]= []
|
||||
lMeta: MCPTLTools = []
|
||||
for tcName in self.toolcalls.keys():
|
||||
lMeta.append(self.toolcalls[tcName].meta())
|
||||
return lMeta
|
||||
|
|
|
|||
Loading…
Reference in New Issue