Skip to main content
Glama
scmdr

SourceSync.ai MCP Server

by scmdr

hybridSearch

Enhance search accuracy by combining keyword and semantic techniques. Input weighted configurations to balance exact matches with context-aware results for optimized query responses.

Instructions

Performs a combined keyword and semantic search, balancing between exact matches and semantic similarity. Requires hybridConfig with weights for both search types.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
filterNo
hybridConfigYes
namespaceIdNo
queryYes
scoreThresholdNo
searchTypeNo
tenantIdNo
topKNo

Implementation Reference

  • MCP tool handler function that extracts parameters, creates SourceSyncApiClient instance, and delegates to its hybridSearch method, handling errors with safeApiCall.
    async (params: any) => { return safeApiCall(async () => { const { namespaceId, query, topK, scoreThreshold, filter, hybridConfig, tenantId, searchType, } = params // Create a client with the provided parameters const client = createClient({ namespaceId, tenantId }) // Call the hybridSearch method with the searchType (default to HYBRID if not provided) return await client.hybridSearch({ query, topK, scoreThreshold, filter, hybridConfig, searchType: searchType || SourceSyncSearchType.HYBRID, }) })
  • Zod schema defining the input parameters and validation for the hybridSearch tool.
    export const HybridSearchSchema = z.object({ namespaceId: namespaceIdSchema.optional(), query: z.string(), topK: z.number().optional(), scoreThreshold: z.number().optional(), filter: z .object({ metadata: z.record(z.union([z.string(), z.array(z.string())])).optional(), }) .optional(), hybridConfig: z.object({ semanticWeight: z.number(), keywordWeight: z.number(), }), tenantId: tenantIdSchema, searchType: SearchTypeEnum.optional(), })
  • src/index.ts:602-633 (registration)
    Registration of the hybridSearch tool with the MCP server, including name, description, input schema, and handler function.
    server.tool( 'hybridSearch', 'Performs a combined keyword and semantic search, balancing between exact matches and semantic similarity. Requires hybridConfig with weights for both search types.', HybridSearchSchema.shape, async (params: any) => { return safeApiCall(async () => { const { namespaceId, query, topK, scoreThreshold, filter, hybridConfig, tenantId, searchType, } = params // Create a client with the provided parameters const client = createClient({ namespaceId, tenantId }) // Call the hybridSearch method with the searchType (default to HYBRID if not provided) return await client.hybridSearch({ query, topK, scoreThreshold, filter, hybridConfig, searchType: searchType || SourceSyncSearchType.HYBRID, }) }) }, )
  • SourceSyncApiClient.hybridSearch method that sends POST request to /v1/search/hybrid endpoint with the search parameters, implementing the core hybrid search logic.
    public async hybridSearch({ query, topK, scoreThreshold, filter, hybridConfig, searchType, }: Omit< SourceSyncHybridSearchRequest, 'namespaceId' >): Promise<SourceSyncSearchResponse> { return this.client .url('/v1/search/hybrid') .json({ query, namespaceId: this.namespaceId, topK, scoreThreshold, filter, hybridConfig, searchType, } satisfies SourceSyncHybridSearchRequest) .post() .json<SourceSyncSearchResponse>() }

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/scmdr/sourcesyncai-mcp'

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