Skip to content

Definition of "oneOf" -type in the tool input stops firecrawl-tool #15

@tisDDM

Description

@tisDDM

I was trying to use firecrawl-mcp-server with Smolagents. The import of the tool collection was not possible because of a type error.

k,v allowExternalLinks {'type': 'boolean', 'description': 'Allow crawling links to external domains'}
k,v webhook {'oneOf': [{'type': 'string', 'description': 'Webhook URL to notify when crawl is complete'}, {'type': 'object', 'properties': {'url': {'type': 'string', 'description': 'Webhook URL'}, 'headers': {'type': 'object', 'description': 'Custom headers for webhook requests'}}, 'required': ['url']}]}

Traceback (most recent call last):
File "/home/tim/research_agent/run_research.py", line 181, in
main()
File "/home/tim/research_agent/run_research.py", line 89, in main
with ToolCollection.from_mcp(server_parameters_firecrawl) as tool_collection_firecrawl:
File "/usr/lib/python3.12/contextlib.py", line 137, in enter
return next(self.gen)
^^^^^^^^^^^^^^
File "/home/tim/research_agent/venv/lib/python3.12/site-packages/smolagents/tools.py", line 823, in from_mcp
with MCPAdapt(server_parameters, SmolAgentsAdapter()) as tools:
File "/home/tim/research_agent/venv/lib/python3.12/site-packages/mcpadapt/core.py", line 210, in enter
return self.tools()
^^^^^^^^^^^^
File "/home/tim/research_agent/venv/lib/python3.12/site-packages/mcpadapt/core.py", line 198, in tools
self.adapter.adapt(partial(_sync_call_tool, tool.name), tool)
File "/home/tim/research_agent/venv/lib/python3.12/site-packages/mcpadapt/smolagents_adapter.py", line 115, in adapt
class_template = _generate_tool_class(
^^^^^^^^^^^^^^^^^^^^^
File "/home/tim/research_agent/venv/lib/python3.12/site-packages/mcpadapt/smolagents_adapter.py", line 74, in _generate_tool_class
smolagents_inputs = _generate_tool_inputs(resolved_json_schema)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/tim/research_agent/venv/lib/python3.12/site-packages/mcpadapt/smolagents_adapter.py", line 34, in _generate_tool_inputs
"type": v.get("type") or v.get("anyOf")[0].get("type"),
~~~~~~~~~~~~~~^^^
TypeError: 'NoneType' object is not subscriptable

I added some checks and handling of oneOf in the code for smolagents and issued a PR ( #14 )

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions