Jump to content

Connect SuperML | Leeroopedia MCP: Equip your AI agents with best practices, code verification, and debugging knowledge. Powered by Leeroo — building Organizational Superintelligence. Contact us at founders@leeroo.com.

Implementation:CrewAIInc CrewAI MDX Search Tool

From Leeroopedia
Revision as of 11:08, 16 February 2026 by Admin (talk | contribs) (Auto-imported from implementations/CrewAIInc_CrewAI_MDX_Search_Tool.md)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Knowledge Sources
Domains Tools, RAG, Search
Last Updated 2026-02-11 00:00 GMT

Overview

MDXSearchTool enables semantic search within MDX (Markdown with JSX) file content using RAG technology.

Description

The MDXSearchTool extends RagTool with MDX-specific functionality for performing natural language queries against MDX documentation files. It defines two Pydantic schema classes: FixedMDXSearchToolSchema (for pre-configured MDX paths requiring only a search query) and MDXSearchToolSchema (for dynamic MDX paths where the file must be specified at runtime). When initialized with an optional mdx file path, the tool adds the file to the RAG knowledge base, updates its description to reference the specific file, and switches to the fixed schema. The add() method explicitly specifies DataType.MDX when adding content to the knowledge base. The _run() method accepts search queries with optional similarity_threshold and limit parameters for fine-tuning result relevance and quantity.

Usage

Use this tool when a CrewAI agent needs to search through MDX documentation files, component libraries, or content-rich websites built with MDX using natural language queries.

Code Reference

Source Location

  • Repository: CrewAI
  • File: lib/crewai-tools/src/crewai_tools/tools/mdx_search_tool/mdx_search_tool.py
  • Lines: 1-51

Signature

class MDXSearchTool(RagTool):
    name: str = "Search a MDX's content"
    description: str = "A tool that can be used to semantic search a query from a MDX's content."
    args_schema: type[BaseModel] = MDXSearchToolSchema

    def __init__(self, mdx: str | None = None, **kwargs): ...

    def add(self, mdx: str) -> None: ...

    def _run(
        self,
        search_query: str,
        mdx: str | None = None,
        similarity_threshold: float | None = None,
        limit: int | None = None,
    ) -> str: ...

Import

from crewai_tools import MDXSearchTool

I/O Contract

Inputs

Name Type Required Description
mdx str or None No File path or URL of an MDX file; if provided at init, locks the tool to that file
search_query str Yes Semantic search query to run against the MDX content
similarity_threshold float or None No Minimum similarity score for returned results
limit int or None No Maximum number of results to return

Outputs

Name Type Description
_run() returns str Semantically matched content from the MDX file

Usage Examples

Fixed MDX File

from crewai_tools import MDXSearchTool

tool = MDXSearchTool(mdx="./docs/components.mdx")
result = tool._run(search_query="button component props")

Dynamic MDX File

from crewai_tools import MDXSearchTool

tool = MDXSearchTool()
result = tool._run(search_query="API reference", mdx="./docs/api.mdx")

Related Pages

Page Connections

Double-click a node to navigate. Hold to expand connections.
Principle
Implementation
Heuristic
Environment