{"record":{"id":"5e62145d6741654a","repo":"crewAIInc/crewAI","slug":"async-is-not-supported-by-the-crewai-framework","errorCode":null,"errorMessage":"async is not supported by the CrewAI framework.","messagePattern":"async is not supported by the CrewAI framework\\.","errorType":"exception","errorClass":"NotImplementedError","httpStatus":null,"severity":"warning","filePath":"lib/crewai-tools/src/crewai_tools/adapters/mcp_adapter.py","lineNumber":89,"sourceCode":"                            for content in result.content\n                            if isinstance(content, TextContent)\n                        ]\n                    )\n\n                def _generate_description(self) -> None:\n                    schema = self.args_schema.model_json_schema()\n                    schema.pop(\"$defs\", None)\n                    self.description = (\n                        f\"Tool Name: {self.name}\\n\"\n                        f\"Tool Arguments: {schema}\\n\"\n                        f\"Tool Description: {self.description}\"\n                    )\n\n            return CrewAIMCPTool()\n\n        async def async_adapt(self, afunc: Any, mcp_tool: Tool) -> Any:\n            \"\"\"Async adaptation is not supported by CrewAI.\"\"\"\n            raise NotImplementedError(\"async is not supported by the CrewAI framework.\")\n\n    MCP_AVAILABLE = True\nexcept ImportError as e:\n    logger.debug(f\"MCP packages not available: {e}\")\n    MCP_AVAILABLE = False\n\n\nclass MCPServerAdapter:\n    \"\"\"Manages the lifecycle of an MCP server and make its tools available to CrewAI.\n\n    Note: tools can only be accessed after the server has been started with the\n        `start()` method.\n\n    Usage:\n        # context manager + stdio\n        with MCPServerAdapter(...) as tools:\n            # tools is now available\n","sourceCodeStart":71,"sourceCodeEnd":107,"githubUrl":"https://github.com/crewAIInc/crewAI/blob/754d7323beb2fd042e33444a115ea2d5a47193f0/lib/crewai-tools/src/crewai_tools/adapters/mcp_adapter.py#L71-L107","documentation":"NotImplementedError raised by CrewAIToolAdapter.async_adapt: the CrewAI framework's tool interface is synchronous, so the MCP adapter has no async adaptation path. Any attempt to adapt an MCP tool coroutine through this adapter is rejected by design, not due to a bug.","triggerScenarios":"Passing CrewAIToolAdapter to an MCPAdapt setup that then calls async_adapt (e.g. a framework expecting per-tool async adapters), or manually invoking adapter.async_adapt(afunc, mcp_tool).","commonSituations":"Reusing the adapter outside crewai-tools in a generic MCP adaptation layer that supports both sync and async; upgrading a pipeline that previously used an async-capable adapter.","solutions":["Use the sync adapt path (CrewAIToolAdapter.adapt) — this is the supported route for CrewAI.","If async execution is required, run the sync CrewAI tool in a worker thread (asyncio.to_thread) instead of the adapter's async_adapt.","Pick a different adapter class for frameworks with native async tool support."],"exampleFix":"# before\nawait adapter.async_adapt(afunc, mcp_tool)  # NotImplementedError\n\n# after\ntool = adapter.adapt(mcp_tool.func, mcp_tool)   # sync adaptation\nresult = await asyncio.to_thread(tool._run, **args)  # async-friendly invocation","handlingStrategy":"fallback","validationCode":null,"typeGuard":"def supports_async(adapter) -> bool:\n    return getattr(adapter, \"async_adapt\", None) is not None and not getattr(adapter, \"async_adapt\").__doc__.startswith(\"Async adaptation is not supported\")","tryCatchPattern":"try:\n    tool = await adapter.async_adapt(afunc, mcp_tool)\nexcept NotImplementedError:\n    tool = adapter.adapt(mcp_tool.func, mcp_tool)  # sync fallback","preventionTips":["Treat CrewAI tools as synchronous; use asyncio.to_thread for non-blocking invocation.","Do not route CrewAIToolAdapter through generic async adaptation layers.","Catch NotImplementedError explicitly when writing adapter-agnostic code."],"tags":["mcp","async","not-implemented","adapter","crewai-tools"],"backgroundTag":null,"analyzedSha":"754d7323beb2fd042e33444a115ea2d5a47193f0","analyzedAt":"2026-08-15T04:06:56.746Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}