agent.py aktualisiert
This commit is contained in:
@@ -35,18 +35,25 @@ class Agent:
|
||||
try:
|
||||
res = await self.mcp.list_tools()
|
||||
|
||||
self.tools = [
|
||||
{
|
||||
self.tools = []
|
||||
for t in res.tools:
|
||||
schema = t.inputSchema
|
||||
|
||||
# Bedrock-kompatibles Format erzwingen
|
||||
if isinstance(schema, dict) and "json" not in schema:
|
||||
bedrock_schema = {"json": schema}
|
||||
else:
|
||||
bedrock_schema = schema
|
||||
|
||||
self.tools.append({
|
||||
"toolSpec": {
|
||||
"name": t.name,
|
||||
"description": t.description,
|
||||
"inputSchema": t.inputSchema
|
||||
"inputSchema": bedrock_schema
|
||||
}
|
||||
}
|
||||
for t in res.tools
|
||||
]
|
||||
})
|
||||
|
||||
self.logger.info(f"{len(self.tools)} Tools erfolgreich geladen")
|
||||
self.logger.info(f"{len(self.tools)} Tools erfolgreich für Bedrock angepasst und geladen")
|
||||
|
||||
except Exception as e:
|
||||
self.logger.error(f"Tool Load Error: {e}")
|
||||
|
||||
Reference in New Issue
Block a user