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,
      };
    }
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 mentions that queries should be specific for best results, hinting at search behavior, but lacks critical details: it doesn't specify the source of documentation (e.g., official docs, community resources), whether it performs real-time web searches or uses a cached index, potential rate limits, authentication needs, or error handling. For a search tool with zero annotation coverage, this leaves significant gaps in understanding how the tool behaves.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is concise and front-loaded: the first sentence states the core purpose, and the second adds usage guidance. Both sentences earn their place by providing essential information without redundancy. However, it could be slightly more structured by explicitly separating purpose from guidelines, but it's efficient overall.

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

Completeness3/5

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

Given the context: no annotations, no output schema, 2 parameters with full schema coverage, and no sibling tools, the description is moderately complete. It covers the basic purpose and offers query specificity advice, but it lacks details on behavioral aspects (e.g., search scope, result format, limitations) that would be crucial for an AI agent to use it effectively. Without an output schema, the description doesn't explain return values, which is a gap, but the schema handles parameters well.

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

Parameters3/5

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

The input schema has 100% description coverage, with clear explanations for both parameters: 'package_name' and 'query'. The description doesn't add any additional semantic information beyond what the schema provides (e.g., it doesn't clarify parameter interactions or provide examples not in the schema). According to the rules, with high schema coverage (>80%), the baseline score is 3 even without param info in the description.

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: 'Search documentation of packages and services to find implementation details, examples, and specifications.' This specifies the verb (search), resource (documentation), and target (packages/services). However, without sibling tools, it cannot demonstrate differentiation from alternatives, so it doesn't reach the highest score.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides some usage guidance: 'The user's query should be as specific as possible to get the best results.' This implies that vague queries may yield poor results, offering practical advice. However, it doesn't explicitly state when to use this tool versus alternatives (e.g., general web search or other documentation tools), and there are no sibling tools to compare against, so the guidance is limited to query specificity.

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

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