Implementation:CrewAIInc CrewAI DOCX Search Tool
| Knowledge Sources | |
|---|---|
| Domains | Tools, RAG, Document_Processing |
| Last Updated | 2026-02-11 00:00 GMT |
Overview
Performs semantic search within DOCX (Microsoft Word) document contents using RAG methodology.
Description
DOCXSearchTool extends RagTool to enable meaning-based search within Microsoft Word documents. It registers DOCX content as DataType.DOCX via the add() method, which indexes the document for semantic retrieval. The tool supports two modes: a dynamic mode where the DOCX file path or URL is specified at runtime via DOCXSearchToolSchema, and a fixed mode where a DOCX file is pre-configured at construction using FixedDOCXSearchToolSchema. Search results can be tuned with similarity_threshold and limit parameters.
Usage
Use this tool when a CrewAI agent needs to extract relevant information from Microsoft Word documents based on semantic meaning. Suitable for document analysis workflows, research agents, and knowledge extraction from business documents stored in DOCX format.
Code Reference
Source Location
- Repository: CrewAI
- File:
lib/crewai-tools/src/crewai_tools/tools/docx_search_tool/docx_search_tool.py - Lines: 1-59
Signature
class DOCXSearchTool(RagTool):
name: str = "Search a DOCX's content"
description: str = "A tool that can be used to semantic search a query from a DOCX's content."
args_schema: type[BaseModel] = DOCXSearchToolSchema
def __init__(self, docx: str | None = None, **kwargs): ...
def add(self, docx: str) -> None: ...
def _run(self, search_query: str, docx: str | None = None,
similarity_threshold: float | None = None, limit: int | None = None) -> Any: ...
Import
from crewai_tools import DOCXSearchTool
I/O Contract
Inputs
| Name | Type | Required | Description |
|---|---|---|---|
| search_query | str | Yes | The semantic search query |
| docx | str | Yes (at init or runtime) | File path or URL of the DOCX document to search |
| similarity_threshold | float | No | Minimum similarity score for results |
| limit | int | No | Maximum number of results to return |
Outputs
| Name | Type | Description |
|---|---|---|
| _run() returns | str | Semantically relevant content from the DOCX document matching the query |
Usage Examples
Dynamic DOCX Path
from crewai_tools import DOCXSearchTool
tool = DOCXSearchTool()
result = tool.run(search_query="quarterly revenue", docx="/path/to/report.docx")
Fixed DOCX Path
from crewai_tools import DOCXSearchTool
tool = DOCXSearchTool(docx="/path/to/report.docx")
result = tool.run(search_query="quarterly revenue")