Skip to main content
Glama

Dedalus MCP Documentation Server

by kitan23

search_docs

Search Dedalus MCP documentation by query, titles, or content to retrieve relevant documents with scores. Supports keyword and semantic search for efficient 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

NameRequiredDescriptionDefault
max_resultsNo
queryYes
search_contentNo
search_titlesNo

Input Schema (JSON Schema)

{ "properties": { "max_results": { "default": 5, "title": "Max Results", "type": "integer" }, "query": { "title": "Query", "type": "string" }, "search_content": { "default": true, "title": "Search Content", "type": "boolean" }, "search_titles": { "default": true, "title": "Search Titles", "type": "boolean" } }, "required": [ "query" ], "title": "search_docsArguments", "type": "object" }

Implementation Reference

  • The complete implementation of the 'search_docs' MCP tool handler. It uses keyword matching to search documentation files, scores results based on title and content matches, extracts relevant snippets, and returns the top results with metadata. The @mcp.tool() decorator handles registration, and the docstring defines the input/output schema.
    @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]

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