Skip to main content
Glama
lroolle

OpenAI Agents MCP Server

by lroolle

multi_tool_agent

Orchestrate AI agents to handle complex tasks by combining web search, file search, and computer actions based on your specific query requirements.

Instructions

Use an AI agent that can orchestrate between web search, file search, and computer actions based on your query.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
enable_computer_actionsNoWhether to enable computer action capabilities.
enable_file_searchNoWhether to enable file search capabilities.
enable_web_searchNoWhether to enable web search capabilities.
queryYesThe query or task you want help with.
vector_store_idsNoRequired if enable_file_search is True. The IDs of the vector stores to search in.

Implementation Reference

  • The complete handler function for the 'multi_tool_agent' MCP tool. It registers the tool via @mcp.tool decorator and implements the logic by constructing a multi-tool orchestrator agent that delegates to web search, file search, or computer action sub-agents based on enabled features and the user query.
    @mcp.tool( name="multi_tool_agent", description="Use an AI agent that can orchestrate between web search, file search, and computer actions based on your query.", ) async def orchestrator_agent( query: str = Field(..., description="The query or task you want help with."), enable_web_search: bool = Field(True, description="Whether to enable web search capabilities."), enable_file_search: bool = Field( False, description="Whether to enable file search capabilities." ), enable_computer_actions: bool = Field( True, description="Whether to enable computer action capabilities." ), vector_store_ids: Optional[List[str]] = Field( None, description="Required if enable_file_search is True. The IDs of the vector stores to search in.", ), ) -> AgentResponse: """Use a specialized orchestrator agent that can delegate to the most appropriate specialized agent.""" try: tools = [] if enable_web_search: tools.append( web_search_agent.as_tool( tool_name="search_web", tool_description="Search the web for information" ) ) if enable_file_search: if not vector_store_ids: return AgentResponse( response="Error: vector_store_ids is required when file search is enabled.", raw_response=None, ) file_search_agent = Agent( name="File Search Assistant", instructions=file_search_instructions, tools=[FileSearchTool(max_num_results=5, vector_store_ids=vector_store_ids)], ) tools.append( file_search_agent.as_tool( tool_name="search_files", tool_description="Search for information in files and documents", ) ) if enable_computer_actions: computer = SimpleAsyncComputer() computer_action_agent = Agent( name="Computer Action Assistant", instructions=computer_action_instructions, tools=[ComputerTool(computer=computer)], ) tools.append( computer_action_agent.as_tool( tool_name="perform_computer_action", tool_description="Perform an action on the computer", ) ) orchestrator = Agent( name="Multi-Tool Orchestrator", instructions="""You are an intelligent orchestrator with access to specialized agents. Based on the user's query, determine which specialized agent(s) can best help and delegate the task to them. Guidelines: 1. For queries about current events or facts, use the web search agent 2. For queries about documents or specific files, use the file search agent 3. For requests to perform actions on the computer, use the computer action agent 4. For complex requests, you can use multiple agents in sequence 5. Always explain your reasoning and which agent(s) you're using """, tools=tools, ) with trace("Orchestrator agent execution"): result = await Runner.run(orchestrator, query) return AgentResponse( response=result.final_output, raw_response={"items": [str(item) for item in result.new_items]}, ) except Exception as e: print(f"Error running orchestrator agent: {e}") return AgentResponse( response=f"An error occurred while processing your request: {str(e)}", raw_response=None )

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/lroolle/openai-agents-mcp-server'

If you have feedback or need assistance with the MCP directory API, please join our Discord server