Skip to main content
Glama
Use-Keen

UseKeen Documentation MCP Server

by Use-Keen

usekeen_package_doc_search

Search package and service documentation to find implementation details, examples, and specifications. Enter the package name and specific query for targeted results.

Instructions

Search documentation of packages and services to find implementation details, examples, and specifications. The user's query should be as specific as possible to get the best results.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
package_nameYesName of the package or service to search documentation for (e.g. 'react', 'aws-s3', 'docker')
queryYesSearch term to find specific information within the package/service documentation (e.g. 'file upload example', 'authentication methods')

Implementation Reference

  • Registers and implements the handler for CallToolRequestSchema. Checks if the tool name is 'usekeen_package_doc_search', parses arguments using the schema, calls the UseKeenClient to perform the search, formats the response, and handles errors.
    server.setRequestHandler( CallToolRequestSchema, async (request: CallToolRequest) => { console.error("Received CallToolRequest:", JSON.stringify(request, null, 2)); try { if (request.params.name === "usekeen_package_doc_search") { const args = PackageDocSearchArgsSchema.parse(request.params.arguments); const response = await useKeenClient.searchPackageDocumentation( args.package_name, args.query ); // Always return spec-compliant content blocks; include structuredContent for clients that support it return formatToolSuccess(response) as unknown as CallToolResult; } else { throw new Error(`Unknown tool: ${request.params.name}`); } } catch (error) { console.error("Error executing tool:", error); // Mark as error using the MCP-compatible flag so clients render it correctly return formatToolError(error) as unknown as CallToolResult; } } );
  • Zod schema defining the input parameters for the 'usekeen_package_doc_search' tool: package_name and query.
    const PackageDocSearchArgsSchema = z.object({ package_name: z.string().describe("Name of the package or service to search documentation for (e.g. 'react', 'aws-s3', 'docker')"), query: z.string().describe("Search term to find specific information within the package/service documentation (e.g. 'file upload example', 'authentication methods')"), });
  • index.ts:190-200 (registration)
    Registers the 'usekeen_package_doc_search' tool in the ListToolsRequestSchema handler, providing name, description, and input schema.
    server.setRequestHandler(ListToolsRequestSchema, async () => { return { tools: [ { name: "usekeen_package_doc_search", description: "Search documentation of packages and services to find implementation details, examples, and specifications. The user's query should be as specific as possible to get the best results.", inputSchema: zodToJsonSchema(PackageDocSearchArgsSchema) as ToolInput, }, ], }; });
  • Method in UseKeenClient class that performs the actual HTTP POST request to the UseKeen API endpoint '/tools/package_doc_search' with package_name and query parameters.
    async searchPackageDocumentation(packageName: string, query?: string): Promise<any> { try { // Create URL with query parameters for the API key const url = new URL(`${this.baseUrl}/tools/package_doc_search`); url.searchParams.append('api_key', this.apiKey); // Log the request details for debugging console.error(`API Request URL: ${url.toString()}`); // Create the request body with direct parameters const requestBody = { package_name: packageName, query: query || "" }; console.error(`API Request Body: ${JSON.stringify(requestBody)}`); const response = await fetch(url.toString(), { method: "POST", headers: { "Content-Type": "application/json" }, body: JSON.stringify(requestBody) }); if (!response.ok) { const errorText = await response.text(); throw new Error(`API request failed: ${response.status} ${errorText}`); } return response.json(); } catch (error) { console.error("Error calling UseKeen API:", error); throw error; } }
  • Formats the API response into MCP-compliant content blocks, handling common result structures and providing a readable text summary.
    function formatToolSuccess(data: unknown): { content: { type: "text"; text: string }[]; structuredContent?: unknown } { // If data appears to already be MCP content blocks, preserve it safely // Otherwise, stringify in a readable form const asText = (value: unknown) => { try { return typeof value === "string" ? value : JSON.stringify(value, null, 2); } catch { return String(value); } }; // Normalize a few common non-spec shapes often seen from HTTP APIs // e.g. { result: { results: [...] } } or { results: [...] } let primary: unknown = data; // @ts-ignore - dynamic inspection of unknown if (data && typeof data === "object" && "result" in (data as any)) { // @ts-ignore - dynamic primary = (data as any).result; } // @ts-ignore - dynamic inspection of unknown if (primary && typeof primary === "object" && "results" in (primary as any)) { // @ts-ignore - dynamic const results = (primary as any).results; if (Array.isArray(results)) { const lines: string[] = []; lines.push(`Found ${results.length} result(s). Showing up to 5:`); for (const [i, item] of results.slice(0, 5).entries()) { // Heuristic for common fields const title = typeof item?.title === "string" ? item.title : undefined; const url = typeof item?.url === "string" ? item.url : undefined; const summary = typeof item?.description === "string" ? item.description : typeof item?.snippet === "string" ? item.snippet : undefined; const header = title ?? url ?? `Result #${i + 1}`; lines.push(`- ${header}`); if (url) lines.push(` ${url}`); if (summary) lines.push(` ${summary}`); } const text = lines.join("\n"); return { content: [{ type: "text", text }], structuredContent: data, }; } } return { content: [{ type: "text", text: asText(data) }], structuredContent: data, }; }

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/Use-Keen/usekeen-mcp-server'

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