Skip to main content
Glama
kitan23

Dedalus MCP Documentation Server

by kitan23

index_docs

Index or re-index all documentation to improve search functionality and query performance across the documentation server.

Instructions

Index or re-index all documentation for improved search

Args:
    rebuild: Whether to rebuild the entire index from scratch

Returns:
    Indexing statistics

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
rebuildNo

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Implementation Reference

  • The handler function for the 'index_docs' MCP tool. It clears caches if rebuild=True, then iterates over all .md files in DOCS_DIR, calls get_doc_metadata on each, accumulates stats on files indexed and total size, catches errors, and returns indexing statistics. Registered via the @mcp.tool() decorator which also defines the schema from the signature and docstring.
    @mcp.tool()
    def index_docs(rebuild: bool = False) -> Dict[str, Any]:
        """
        Index or re-index all documentation for improved search
    
        Args:
            rebuild: Whether to rebuild the entire index from scratch
    
        Returns:
            Indexing statistics
        """
        if rebuild:
            METADATA_CACHE.clear()
            EMBEDDINGS_CACHE.clear()
    
        stats = {
            'files_indexed': 0,
            'total_size': 0,
            'errors': [],
            'timestamp': datetime.now().isoformat(),
        }
    
        for file_path in DOCS_DIR.rglob('*.md'):
            try:
                if file_path.is_file():
                    metadata = get_doc_metadata(file_path)
                    stats['files_indexed'] += 1
                    stats['total_size'] += metadata['size']
    
                    # Here you would generate embeddings for semantic search
                    # EMBEDDINGS_CACHE[file_path] = generate_embeddings(content)
            except Exception as e:
                stats['errors'].append({'file': str(file_path), 'error': str(e)})
    
        return stats
  • Helper function used by index_docs (and other tools) to extract metadata like title, path, modified time, size, hash from markdown files, caching the results in METADATA_CACHE. Attempts to parse title from first H1 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
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. It mentions that the tool performs indexing/re-indexing, implying a write operation that could be resource-intensive, but doesn't disclose critical traits like required permissions, whether it's idempotent, potential side effects (e.g., downtime during re-indexing), or rate limits. The return value is vaguely described as 'Indexing statistics' without detailing format or content.

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 concise, with a clear purpose statement followed by dedicated 'Args' and 'Returns' sections. Every sentence adds value: the first explains the tool's function, and the subsequent lines document input and output semantics without redundancy. It's appropriately sized for a single-parameter tool.

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's moderate complexity (a write operation with one parameter) and the presence of an output schema (which should cover return values), the description is minimally adequate. It explains the tool's purpose and parameter semantics but lacks behavioral details (e.g., permissions, side effects) that are crucial for a mutation tool without annotations. The output schema likely handles 'Indexing statistics', so that gap is mitigated.

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?

The description adds meaningful context for the single parameter 'rebuild', explaining it as 'Whether to rebuild the entire index from scratch'. This clarifies the semantic difference between a standard index update and a full rebuild, which isn't evident from the schema alone (which has 0% description coverage and only shows a boolean with default false). For a tool with 1 parameter, this provides adequate compensation.

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: 'Index or re-index all documentation for improved search'. It specifies the verb ('index/re-index'), resource ('all documentation'), and outcome ('improved search'). However, it doesn't explicitly differentiate from sibling tools like 'analyze_docs' or 'list_docs', which might have overlapping search-related 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 no guidance on when to use this tool versus alternatives like 'search_docs' or 'analyze_docs'. It mentions the purpose but doesn't specify contexts, prerequisites, or exclusions for usage. The agent must infer usage from the tool name and description 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