search_better_auth
Search Better Auth documentation to find authentication features, provider configurations, and setup guides for modern web frameworks.
Instructions
Search Better Auth documentation by keyword
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"query": "<query>"
},
"name": "search_better_auth"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| query | Yes | Search query to find relevant Better Auth features or documentation |
Implementation Reference
- src/index.ts:510-529 (handler)The main handler function for the 'search_better_auth' tool. It validates the input query, ensures features are loaded, performs the search using searchFeaturesByQuery, limits results to top 10, and returns a formatted response.
/** * Handle the search_better_auth tool request */ private async handleSearchBetterAuth(args: any) { const query = this.validateSearchQuery(args); try { await this.ensureFeaturesListLoaded(); const results = this.searchFeaturesByQuery(query); return this.createSuccessResponse({ query, results: results.slice(0, 10), // Limit to top 10 results total: results.length, }); } catch (error) { this.handleAxiosError(error, "Search failed"); } } - src/index.ts:195-209 (schema)The tool schema definition including name, description, and input schema requiring a 'query' string.
{ name: "search_better_auth", description: "Search Better Auth documentation by keyword", inputSchema: { type: "object", properties: { query: { type: "string", description: "Search query to find relevant Better Auth features or documentation", }, }, required: ["query"], }, }, { - src/index.ts:231-232 (registration)The switch case registration that dispatches calls to the search_better_auth tool to its handler.
case "search_better_auth": return await this.handleSearchBetterAuth(request.params.arguments); - src/index.ts:717-739 (helper)Core search logic helper that filters and sorts cached BetterAuthFeatures based on query terms, prioritizing exact name matches.
* Search features by query */ private searchFeaturesByQuery(query: string): BetterAuthFeature[] { if (!this.featuresListCache) { return []; } const searchTerms = query.toLowerCase().split(' '); return this.featuresListCache.filter(feature => { const searchText = `${feature.name} ${feature.description} ${feature.category}`.toLowerCase(); return searchTerms.some(term => searchText.includes(term)); }).sort((a, b) => { // Prioritize exact matches const aExact = a.name.toLowerCase().includes(query.toLowerCase()); const bExact = b.name.toLowerCase().includes(query.toLowerCase()); if (aExact && !bExact) return -1; if (!aExact && bExact) return 1; return 0; }); } - src/index.ts:764-772 (helper)Helper function to validate and normalize the search query input.
private validateSearchQuery(args: any): string { if (!args?.query || typeof args.query !== "string") { throw new McpError( ErrorCode.InvalidParams, "Search query is required and must be a string" ); } return args.query.toLowerCase(); }