44from strands import Agent
55from strands .tools .mcp .mcp_client import MCPClient
66
7- # IMPORT MODELLO MISTRAL
7+ # IMPORT MISTRAL MODEL
88from strands .models .mistral import MistralModel
99import os
1010MISTRAL_API_KEY = os .getenv ("MISTRAL_API_KEY" )
1111
1212def create_streamable_http_transport ():
13- # L’ URL deve essere quello del tuo server FastMCP
13+ # The URL must be the one of your FastMCP server
1414 return streamablehttp_client ("http://localhost:8000/mcp/" )
1515
1616
1717def main ():
18- # 1) Crea client MCP
18+ # 1) Create the MCP client
1919 streamable_http_mcp_client = MCPClient (create_streamable_http_transport )
2020
2121 with streamable_http_mcp_client :
22- # 2) Lista tool MCP
22+ # 2) List available MCP tools
2323 tools = streamable_http_mcp_client .list_tools_sync ()
24- print ("TOOLS disponibili :" , [getattr (t , "name" , t .mcp_tool .name ) for t in tools ])
24+ print ("Available TOOLS :" , [getattr (t , "name" , t .mcp_tool .name ) for t in tools ])
2525
26- # 3) Crea l'agente con Mistral
26+ # 3) Create the agent using Mistral
2727 agent = Agent (
2828 tools = tools ,
2929 model = MistralModel (
@@ -34,17 +34,17 @@ def main():
3434 ),
3535 )
3636
37- # 4) Esegui domanda tramite agente
37+ # 4) Ask a question through the agent
3838 response = agent ("What is 125 plus 375?" )
39- print ("Risposta agente :" , response )
39+ print ("Agent response :" , response )
4040
41- # 5) Oppure invoca il tool direttamente
41+ # 5) Or directly call a tool
4242 result = streamable_http_mcp_client .call_tool_sync (
4343 tool_use_id = "tool-1" ,
4444 name = "neo4j_query" ,
4545 arguments = {"x" : 125 , "y" : 375 },
4646 )
47- print ("Risultato calcolatore :" , result ["content" ][0 ]["text" ])
47+ print ("Calculator result :" , result ["content" ][0 ]["text" ])
4848
4949
5050if __name__ == "__main__" :
0 commit comments