Skip to main content
Glama
kitan23

Dedalus MCP Documentation Server

by kitan23

search_docs

Find documentation by searching titles and content with keyword matching. Returns relevant documents with scores for precise information retrieval.

Instructions

Search documentation using keyword matching (semantic search ready)

Args:
    query: Search query string
    max_results: Maximum number of results to return
    search_content: Whether to search in document content
    search_titles: Whether to search in document titles

Returns:
    List of matching documents with relevance scores

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
queryYes
max_resultsNo
search_contentNo
search_titlesNo

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Implementation Reference

  • The primary handler for the 'search_docs' MCP tool. This function is decorated with @mcp.tool() and implements keyword-based search across all markdown documentation files in the docs directory. It searches titles and content, computes relevance scores, extracts snippets around matches, and returns the top results sorted by score.
    @mcp.tool()
    def search_docs(
        query: str,
        max_results: int = 5,
        search_content: bool = True,
        search_titles: bool = True,
    ) -> List[Dict[str, Any]]:
        """
        Search documentation using keyword matching (semantic search ready)
    
        Args:
            query: Search query string
            max_results: Maximum number of results to return
            search_content: Whether to search in document content
            search_titles: Whether to search in document titles
    
        Returns:
            List of matching documents with relevance scores
        """
        query_lower = query.lower()
        results = []
    
        for file_path in DOCS_DIR.rglob('*.md'):
            if not file_path.is_file():
                continue
    
            score = 0
            metadata = get_doc_metadata(file_path)
    
            # Title matching
            if search_titles and query_lower in metadata['title'].lower():
                score += 10
    
            # Content matching
            if search_content:
                try:
                    content = file_path.read_text().lower()
                    # Count occurrences
                    occurrences = content.count(query_lower)
                    if occurrences > 0:
                        score += min(occurrences, 5)  # Cap at 5 points for content
    
                        # Find snippet around first occurrence
                        idx = content.find(query_lower)
                        start = max(0, idx - 100)
                        end = min(len(content), idx + 100)
                        snippet = content[start:end]
                        if start > 0:
                            snippet = '...' + snippet
                        if end < len(content):
                            snippet = snippet + '...'
                        metadata['snippet'] = snippet
                except (OSError, UnicodeDecodeError):
                    pass
    
            if score > 0:
                metadata['relevance_score'] = score
                results.append(metadata)
    
        # Sort by relevance score
        results.sort(key=lambda x: x['relevance_score'], reverse=True)
    
        return results[:max_results]
  • Helper function 'get_doc_metadata' used by search_docs to retrieve metadata (title, path, modified time, size, hash) for each documentation file, including extracting title from the first heading.
    def get_doc_metadata(file_path: Path) -> Dict[str, Any]:
        """Extract metadata from markdown files"""
        if file_path in METADATA_CACHE:
            return METADATA_CACHE[file_path]
    
        metadata = {
            'title': file_path.stem.replace('-', ' ').title(),
            'path': str(file_path.relative_to(DOCS_DIR)),
            'modified': datetime.fromtimestamp(file_path.stat().st_mtime).isoformat(),
            'size': file_path.stat().st_size,
            'hash': hashlib.md5(file_path.read_bytes()).hexdigest(),
        }
    
        # Try to extract title from first # heading
        try:
            content = file_path.read_text()
            lines = content.split('\n')
            for line in lines[:10]:  # Check first 10 lines
                if line.startswith('# '):
                    metadata['title'] = line[2:].strip()
                    break
        except (OSError, UnicodeDecodeError):
            pass
    
        METADATA_CACHE[file_path] = metadata
        return metadata
  • src/main.py:204-204 (registration)
    The @mcp.tool() decorator on search_docs registers it as an available MCP tool.
    @mcp.tool()
Behavior3/5

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

No annotations are provided, so the description carries the full burden. It mentions 'semantic search ready', hinting at advanced search capabilities, but doesn't disclose behavioral traits like rate limits, authentication needs, or whether results are paginated. The description adds some value but leaves significant gaps for a tool with no annotation coverage.

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

Conciseness5/5

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

The description is well-structured and front-loaded with the core purpose, followed by clear sections for 'Args' and 'Returns'. Every sentence adds value without redundancy, making it efficient and easy to parse for an AI agent.

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

Completeness4/5

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

Given the tool's moderate complexity (4 parameters, no annotations), the description covers the purpose, parameters, and return values adequately. The presence of an output schema means it doesn't need to explain return details, but it lacks context on usage guidelines and some behavioral aspects, keeping it from a perfect score.

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?

Schema description coverage is 0%, so the description must compensate. It lists all four parameters with brief explanations (e.g., 'Search query string'), adding meaning beyond the schema's titles. However, it doesn't detail constraints like query length limits or default behaviors, preventing a perfect score.

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: 'Search documentation using keyword matching (semantic search ready)'. It specifies the verb ('search'), resource ('documentation'), and method ('keyword matching'), but doesn't explicitly differentiate it from sibling tools like 'analyze_docs' or 'ask_docs', which prevents a perfect score.

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 no guidance on when to use this tool versus alternatives like 'analyze_docs', 'ask_docs', or 'list_docs'. It lacks context about scenarios where keyword search is preferred over other methods, leaving the agent to infer usage based on tool names alone.

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/kitan23/Python_MCP_Server_Example_2'

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