Skip to main content
Glama
rspace-os

RSpace MCP Server

Official
by rspace-os

find_documents_by_content

Search RSpace documents by content terms using AND/OR operators, with options to exclude terms, sort results, and control page size.

Instructions

Advanced content-based document search

Usage: Find documents containing specific content terms

Parameters:

  • content_terms: List of terms that should appear in document content

  • operator: "and" (all terms must appear) or "or" (any term can appear)

  • exclude_terms: Optional list of terms to exclude from results

  • order_by: Sort results by field

  • page_size: Number of results to return

Returns: Dictionary with search results

Example: find_documents_by_content(["DNA", "extraction"], operator="and")

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
content_termsYes
operatorNoand
exclude_termsNo
order_byNolastModified desc
page_sizeNo

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • main.py:355-404 (handler)
    The handler function for the 'find_documents_by_content' MCP tool. It uses RSpace's AdvancedQueryBuilder for full-text search on document content with support for AND/OR operators and post-query exclusion filtering on document metadata.
    @mcp.tool(tags={"rspace", "search"})
    def find_documents_by_content(
        content_terms: List[str],
        operator: Literal["and", "or"] = "and",
        exclude_terms: List[str] = None,
        order_by: str = "lastModified desc",
        page_size: int = 20
    ) -> dict:
        """
        Advanced content-based document search
        
        Usage: Find documents containing specific content terms
        
        Parameters:
        - content_terms: List of terms that should appear in document content
        - operator: "and" (all terms must appear) or "or" (any term can appear)
        - exclude_terms: Optional list of terms to exclude from results
        - order_by: Sort results by field
        - page_size: Number of results to return
        
        Returns: Dictionary with search results
        
        Example: find_documents_by_content(["DNA", "extraction"], operator="and")
        """
        builder = AdvancedQueryBuilder(operator=operator)
        
        for term in content_terms:
            builder.add_term(term, AdvancedQueryBuilder.QueryType.FULL_TEXT)
        
        # Note: RSpace API doesn't directly support exclusion, but we can filter results
        advanced_query = builder.get_advanced_query()
        results = eln_cli.get_documents_advanced_query(
            advanced_query=advanced_query,
            order_by=order_by,
            page_number=0,
            page_size=page_size
        )
        
        # Filter out documents containing excluded terms if specified
        if exclude_terms and 'documents' in results:
            filtered_docs = []
            for doc in results['documents']:
                # Check if any exclude terms are in the document name or other available text
                doc_text = (doc.get('name', '') + ' ' + doc.get('tags', '')).lower()
                if not any(exclude_term.lower() in doc_text for exclude_term in exclude_terms):
                    filtered_docs.append(doc)
            results['documents'] = filtered_docs
            results['totalHits'] = len(filtered_docs)
        
        return results
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries the full burden of behavioral disclosure. While it mentions the tool is for 'search' and describes parameters, it doesn't disclose important behavioral traits like whether this is a read-only operation, potential rate limits, authentication requirements, or what happens with large result sets. The example helps but doesn't cover behavioral aspects.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is well-structured with clear sections (purpose, usage, parameters, returns, example) and appropriately sized. Each sentence adds value, though the 'Advanced content-based document search' header could be more integrated with the following text. The example is helpful but could be slightly more concise.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool has 5 parameters with 0% schema description coverage but has an output schema, the description provides good parameter semantics but lacks behavioral context. For a search tool with multiple sibling search alternatives, the description should provide more comparative guidance. The presence of an output schema reduces the need to explain return values, but overall completeness is adequate with clear gaps.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

With 0% schema description coverage, the description provides meaningful semantic information for all 5 parameters, explaining what each parameter controls (e.g., 'operator: "and" (all terms must appear) or "or" (any term can appear)'). This compensates well for the lack of schema descriptions, though it doesn't provide format details for 'order_by' beyond 'Sort results by field'.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool's purpose as 'Advanced content-based document search' and 'Find documents containing specific content terms', which is a specific verb+resource combination. However, it doesn't explicitly distinguish this from sibling tools like 'search_documents' or 'search_by_tags', which appear to be related search functions.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides minimal usage guidance with 'Usage: Find documents containing specific content terms' but offers no explicit guidance on when to use this tool versus alternatives like 'search_documents' or 'search_by_tags'. There's no mention of prerequisites, limitations, or comparative context with sibling tools.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/rspace-os/rspace-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server