From 04fec31f1ec1e3edfe77036494ac784f0735a769 Mon Sep 17 00:00:00 2001 From: Vinicius Brasil Date: Tue, 30 Jun 2026 10:24:21 -0700 Subject: [PATCH] Type tool and app in CrewDefinition (#6395) * Type tool and app in CrewDefinition This commit fixes a bug in the CrewDefinition class where the tool and app were not being added. * Type mcps= parameter --- .../src/crewai/project/crew_definition.py | 38 +++++++++++++++++++ lib/crewai/tests/test_flow_from_definition.py | 3 ++ 2 files changed, 41 insertions(+) diff --git a/lib/crewai/src/crewai/project/crew_definition.py b/lib/crewai/src/crewai/project/crew_definition.py index 863e97086..f69787766 100644 --- a/lib/crewai/src/crewai/project/crew_definition.py +++ b/lib/crewai/src/crewai/project/crew_definition.py @@ -74,6 +74,44 @@ class CrewAgentDefinition(BaseModel): description="Additional agent settings passed to the loader.", examples=[{"llm": "openai/gpt-4o-mini"}], ) + tools: list[str | dict[str, Any]] | None = Field( + default=None, + description=( + "Tool refs or serialized tool definitions available to this agent. " + "String refs can use CrewAI tool names, `custom:`, or fully " + "qualified `module:Class` references." + ), + examples=[["crewai_tools:SerperDevTool", "custom:file_read"]], + ) + apps: list[str] | None = Field( + default=None, + description=( + "Platform apps available to this agent. Can contain app names such as " + "`gmail` or app/action refs such as `gmail/send_email`." + ), + examples=[["gmail", "slack/send_message"]], + ) + mcps: list[str | dict[str, Any]] | None = Field( + default=None, + description=( + "MCP server refs or serialized MCP server configs available to this " + "agent. String refs can use HTTPS URLs, connected MCP integration " + "slugs, or refs with a `#tool_name` suffix for specific tools." + ), + examples=[ + [ + "https://api.weather.com/mcp#get_current_weather", + "snowflake", + "stripe#list_invoices", + { + "url": "https://api.example.com/mcp", + "headers": {"Authorization": "Bearer your_token"}, + "streamable": True, + "cache_tools_list": True, + }, + ] + ], + ) @field_validator("settings", mode="before") @classmethod diff --git a/lib/crewai/tests/test_flow_from_definition.py b/lib/crewai/tests/test_flow_from_definition.py index 7764037bf..2a718d29d 100644 --- a/lib/crewai/tests/test_flow_from_definition.py +++ b/lib/crewai/tests/test_flow_from_definition.py @@ -1328,6 +1328,9 @@ def test_crew_action_json_schema_describes_inline_crew_definitions(): "goal", "backstory", "settings", + "tools", + "apps", + "mcps", } assert set(schema_defs["CrewTaskDefinition"]["properties"]) >= { "description",