mirror of https://github.com/dapr/dapr-agents.git
				
				
				
			Fix code formatting with ruff
This commit is contained in:
		
							parent
							
								
									94bf5d2a38
								
							
						
					
					
						commit
						83fc449e39
					
				|  | @ -5,6 +5,7 @@ from dotenv import load_dotenv | |||
| from dapr_agents import AssistantAgent | ||||
| from dapr_agents.tool.mcp import MCPClient | ||||
| 
 | ||||
| 
 | ||||
| async def main(): | ||||
|     try: | ||||
|         # Load MCP tools from server (stdio or sse) | ||||
|  | @ -38,6 +39,7 @@ async def main(): | |||
|     except Exception as e: | ||||
|         logging.exception("Error starting weather agent service", exc_info=e) | ||||
| 
 | ||||
| 
 | ||||
| if __name__ == "__main__": | ||||
|     load_dotenv() | ||||
|     logging.basicConfig(level=logging.INFO) | ||||
|  |  | |||
|  | @ -3,12 +3,14 @@ import random | |||
| 
 | ||||
| mcp = FastMCP("TestServer") | ||||
| 
 | ||||
| 
 | ||||
| @mcp.tool() | ||||
| async def get_weather(location: str) -> str: | ||||
|     """Get weather information for a specific location.""" | ||||
|     temperature = random.randint(60, 80) | ||||
|     return f"{location}: {temperature}F." | ||||
| 
 | ||||
| 
 | ||||
| @mcp.tool() | ||||
| async def jump(distance: str) -> str: | ||||
|     """Simulate a jump of a given distance.""" | ||||
|  |  | |||
|  | @ -8,8 +8,8 @@ from dapr_agents.tool.mcp import MCPClient | |||
| 
 | ||||
| load_dotenv() | ||||
| 
 | ||||
| async def main(): | ||||
| 
 | ||||
| async def main(): | ||||
|     # Create the MCP client | ||||
|     client = MCPClient() | ||||
| 
 | ||||
|  | @ -17,7 +17,7 @@ async def main(): | |||
|     await client.connect_stdio( | ||||
|         server_name="local", | ||||
|         command=sys.executable,  # Use the current Python interpreter | ||||
|         args=["tools.py"]  # Run tools.py directly | ||||
|         args=["tools.py"],  # Run tools.py directly | ||||
|     ) | ||||
| 
 | ||||
|     # Get available tools from the MCP instance | ||||
|  | @ -44,5 +44,6 @@ async def main(): | |||
|     # Clean up resources | ||||
|     await client.close() | ||||
| 
 | ||||
| 
 | ||||
| if __name__ == "__main__": | ||||
|     asyncio.run(main()) | ||||
|  |  | |||
|  | @ -3,17 +3,20 @@ import random | |||
| 
 | ||||
| mcp = FastMCP("TestServer") | ||||
| 
 | ||||
| 
 | ||||
| @mcp.tool() | ||||
| async def get_weather(location: str) -> str: | ||||
|     """Get weather information for a specific location.""" | ||||
|     temperature = random.randint(60, 80) | ||||
|     return f"{location}: {temperature}F." | ||||
| 
 | ||||
| 
 | ||||
| @mcp.tool() | ||||
| async def jump(distance: str) -> str: | ||||
|     """Simulate a jump of a given distance.""" | ||||
|     return f"I jumped the following distance: {distance}" | ||||
| 
 | ||||
| 
 | ||||
| # When run directly, serve tools over STDIO | ||||
| if __name__ == "__main__": | ||||
|     mcp.run("stdio") | ||||
		Loading…
	
		Reference in New Issue