@utcp/sdk
Version:
Universal Tool Calling Protocol (UTCP) client library for TypeScript
30 lines (29 loc) • 1.29 kB
TypeScript
import { Tool } from '../../shared/tool';
import { ToolRepository } from '../tool-repository';
import { ToolSearchStrategy } from '../tool-search-strategy';
/**
* Implements a tool search strategy based on tag and description matching.
* Tools are scored based on the occurrence of query words in their tags and description.
*/
export declare class TagSearchStrategy implements ToolSearchStrategy {
private readonly toolRepository;
/**
* Weight for description words vs. explicit tags (explicit tags have a weight of 1.0).
*/
private readonly descriptionWeight;
/**
* Creates an instance of TagSearchStrategy.
*
* @param toolRepository The repository to search for tools.
* @param descriptionWeight The weight to apply to words found in the tool's description.
*/
constructor(toolRepository: ToolRepository, descriptionWeight?: number);
/**
* Searches for tools by matching tags and description content against a query.
*
* @param query The search query string.
* @param limit The maximum number of tools to return. If 0, all matched tools are returned.
* @returns A promise that resolves to a list of tools ordered by relevance.
*/
searchTools(query: string, limit?: number): Promise<Tool[]>;
}