agent.py aktualisiert

This commit is contained in:
2026-07-05 13:00:00 +00:00
parent 85290cebd2
commit c7fdc6a912
+14 -7
View File
@@ -35,18 +35,25 @@ class Agent:
try: try:
res = await self.mcp.list_tools() 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": { "toolSpec": {
"name": t.name, "name": t.name,
"description": t.description, "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: except Exception as e:
self.logger.error(f"Tool Load Error: {e}") self.logger.error(f"Tool Load Error: {e}")