Skip to main content
Glama
jakedx6
by jakedx6

semantic_search

Search project data using natural language queries to find semantically related content across documents, tasks, and initiatives based on meaning rather than exact keywords.

Instructions

Perform semantic similarity search using AI embeddings

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
queryYesNatural language search query
context_typeNoType of context to optimize search forgeneral
similarity_thresholdNoMinimum similarity score for results
max_resultsNoMaximum number of results
include_explanationsNoInclude explanations of why items matched

Implementation Reference

  • Main handler function for the semantic_search tool. Parses input, performs semantic search using helpers, adds explanations if requested, and returns structured results.
    export const semanticSearch = requireAuth(async (args: any) => { const { query, context_type, similarity_threshold, max_results, include_explanations } = SemanticSearchSchema.parse(args) logger.info('Performing semantic search', { query, context_type, similarity_threshold }) // For now, implement a simplified semantic search using keyword expansion // In production, this would use actual embeddings/vector search const expandedQuery = expandSemanticQuery(query, context_type) const semanticResults = await performSemanticSearch(expandedQuery, similarity_threshold, max_results) if (include_explanations) { semanticResults.forEach((result: any) => { result.match_explanation = generateMatchExplanation(result, query, context_type) }) } return { original_query: query, expanded_query: expandedQuery, context_type, similarity_threshold, results: semanticResults, total_matches: semanticResults.length } })
  • Zod schema for validating inputs to the semantic_search tool.
    const SemanticSearchSchema = z.object({ query: z.string().min(1), context_type: z.enum(['project_context', 'technical_documentation', 'meeting_notes', 'code_related', 'general']).default('general'), similarity_threshold: z.number().min(0).max(1).default(0.7), max_results: z.number().min(1).max(50).default(10), include_explanations: z.boolean().default(false) })
  • MCPTool definition and registration for semantic_search, including name, description, and inputSchema.
    export const semanticSearchTool: MCPTool = { name: 'semantic_search', description: 'Perform semantic similarity search using AI embeddings', inputSchema: { type: 'object', properties: { query: { type: 'string', description: 'Natural language search query' }, context_type: { type: 'string', enum: ['project_context', 'technical_documentation', 'meeting_notes', 'code_related', 'general'], default: 'general', description: 'Type of context to optimize search for' }, similarity_threshold: { type: 'number', minimum: 0, maximum: 1, default: 0.7, description: 'Minimum similarity score for results' }, max_results: { type: 'number', minimum: 1, maximum: 50, default: 10, description: 'Maximum number of results' }, include_explanations: { type: 'boolean', default: false, description: 'Include explanations of why items matched' } }, required: ['query'] } }
  • Export of handlers object that maps 'semantic_search' to the semanticSearch handler function.
    export const intelligentSearchHandlers = { universal_search: universalSearch, semantic_search: semanticSearch, get_search_suggestions: getSearchSuggestions, get_search_analytics: getSearchAnalytics }
  • src/index.ts:143-155 (registration)
    Global registration where intelligentSearchHandlers (including semantic_search) are spread into allHandlers used by the MCP server.
    this.allHandlers = { ...projectHandlers, ...taskHandlers, ...documentHandlers, ...conversationHandlers, ...contextAggregationHandlers, ...workflowAutomationHandlers, ...intelligentSearchHandlers, ...analyticsInsightsHandlers, ...initiativeHandlers, ...promptToProjectTools.reduce((acc, tool) => ({ ...acc, [tool.name]: tool.handler }), {}), ...debugHandlers, }

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/jakedx6/helios9-MCP-Server'

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