Skip to main content
Glama

semanticSearch

Find relevant content by meaning across knowledge bases using semantic search, enabling discovery beyond exact keyword matches.

Instructions

Performs semantic search across the namespace to find relevant content based on meaning rather than exact keyword matches.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
namespaceIdNo
queryYes
topKNo
scoreThresholdNo
filterNo
tenantIdNo
searchTypeNo

Implementation Reference

  • MCP tool handler function for 'semanticSearch' that extracts parameters, creates SourceSyncApiClient, and delegates to its semanticSearch method.
    async (params: any) => {
      return safeApiCall(async () => {
        const {
          namespaceId,
          query,
          topK,
          scoreThreshold,
          filter,
          tenantId,
          searchType,
        } = params
    
        // Create a client with the provided parameters
        const client = createClient({ namespaceId, tenantId })
    
        // Call the semanticSearch method with the searchType (default to SEMANTIC if not provided)
        return await client.semanticSearch({
          query,
          topK,
          scoreThreshold,
          filter,
          searchType: searchType || SourceSyncSearchType.SEMANTIC,
        })
      })
    },
  • Zod schema (SemanticSearchSchema) defining the input validation for the semanticSearch tool, including query, optional topK, scoreThreshold, filter, etc.
    export const SemanticSearchSchema = 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(),
      tenantId: tenantIdSchema,
      searchType: SearchTypeEnum.optional(),
    })
  • src/index.ts:571-600 (registration)
    Registers the 'semanticSearch' tool with the MCP server using server.tool, specifying name, description, input schema, and handler function.
    server.tool(
      'semanticSearch',
      'Performs semantic search across the namespace to find relevant content based on meaning rather than exact keyword matches.',
      SemanticSearchSchema.shape,
      async (params: any) => {
        return safeApiCall(async () => {
          const {
            namespaceId,
            query,
            topK,
            scoreThreshold,
            filter,
            tenantId,
            searchType,
          } = params
    
          // Create a client with the provided parameters
          const client = createClient({ namespaceId, tenantId })
    
          // Call the semanticSearch method with the searchType (default to SEMANTIC if not provided)
          return await client.semanticSearch({
            query,
            topK,
            scoreThreshold,
            filter,
            searchType: searchType || SourceSyncSearchType.SEMANTIC,
          })
        })
      },
    )
  • SourceSyncApiClient.semanticSearch helper method that makes the POST request to SourceSync API /v1/search endpoint to execute the semantic search.
     */
    public async semanticSearch({
      query,
      topK,
      scoreThreshold,
      filter,
      searchType,
    }: Omit<
      SourceSyncSemanticSearchRequest,
      'namespaceId'
    >): Promise<SourceSyncSearchResponse> {
      return this.client
        .url('/v1/search')
        .json({
          query,
          namespaceId: this.namespaceId,
          topK,
          scoreThreshold,
          filter,
          searchType,
        } satisfies SourceSyncSemanticSearchRequest)
        .post()
        .json<SourceSyncSearchResponse>()
    }
Behavior2/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 of behavioral disclosure. It states the tool performs semantic search but doesn't describe what the search returns (e.g., documents, snippets, scores), whether it's paginated, rate-limited, or has authentication requirements. For a search tool with 7 parameters and no annotation coverage, this is a significant gap in behavioral context.

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 a single, well-structured sentence that efficiently conveys the core purpose. It's front-loaded with the main action and avoids unnecessary words. Every part of the sentence earns its place by defining the tool's unique semantic approach.

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

Completeness2/5

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

Given the complexity (7 parameters, nested objects, no output schema, and no annotations), the description is incomplete. It doesn't explain the return values, parameter usage, or behavioral traits. For a semantic search tool with rich input options, more context is needed to guide effective use.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters2/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 0%, meaning none of the 7 parameters are documented in the schema. The description mentions 'namespace' and 'query' implicitly but doesn't explain any parameters like 'topK', 'scoreThreshold', 'filter', 'tenantId', or 'searchType'. It adds minimal semantic value beyond what's inferable from the tool name.

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: 'Performs semantic search across the namespace to find relevant content based on meaning rather than exact keyword matches.' This specifies the verb ('performs semantic search'), resource ('across the namespace'), and distinguishes semantic from keyword-based search. However, it doesn't explicitly differentiate from sibling 'hybridSearch', which is a similar search tool.

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. It mentions semantic search but doesn't explain when to choose it over 'hybridSearch' or other search-related siblings. There are no prerequisites, exclusions, or comparative context provided.

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

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