Skip to main content
Glama
cskwork

Knowledge Retrieval Server

by cskwork

list-domains

Discover available knowledge domains and their document counts to identify relevant content areas for search and retrieval operations.

Instructions

List all available domains and their document counts.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The main handler for the 'list-domains' tool call. It invokes repository.listDomains(), formats the results into a markdown list, and returns as TextContent.
    case 'list-domains': {
      console.error(`[DEBUG] list-domains called`);
      const domains = repository.listDomains();
      console.error(`[DEBUG] domains found: ${JSON.stringify(domains)}`);
      
      if (domains.length === 0) {
        const content: TextContent[] = [{
          type: 'text',
          text: `## Available Domains\n\nNo domains found. Check if documents are loaded properly.`
        }];
        return { content };
      }
    
      const domainList = domains
        .map(d => `- ${d.name}: ${d.documentCount} documents`)
        .join('\n');
    
      const content: TextContent[] = [{
        type: 'text',
        text: `## Available Domains\n\n${domainList}`
      }];
      
      return { content };
    }
  • Core helper method in DocumentRepository that iterates over all documents, groups by domainName (default 'general'), and returns array of {name, documentCount}.
    listDomains(): Array<{ name: string; documentCount: number }> {
      this.ensureInitialized();
      console.error(`[DEBUG] listDomains called on instance ${this.instanceId}, documents.size=${this.documents.size}`);
      const domainCounts = new Map<string, number>();
    
      this.documents.forEach(doc => {
        const domain = doc.domainName || 'general';
        console.error(`[DEBUG] Processing document: ID=${doc.id}, domain=${domain}`);
        domainCounts.set(domain, (domainCounts.get(domain) || 0) + 1);
      });
    
      console.error(`[DEBUG] domainCounts Map: ${JSON.stringify([...domainCounts.entries()])}`);
      const result = Array.from(domainCounts.entries()).map(([name, count]) => ({
        name,
        documentCount: count
      }));
      console.error(`[DEBUG] listDomains result: ${JSON.stringify(result)}`);
    
      return result;
    }
  • src/index.ts:253-260 (registration)
    Tool registration in ListToolsRequestSchema handler, including name, description, and empty input schema (no parameters required).
    {
      name: 'list-domains',
      description: 'List all available domains and their document counts.',
      inputSchema: {
        type: 'object',
        properties: {}
      }
    },
  • Input schema for 'list-domains' tool: empty object (no input parameters).
    inputSchema: {
      type: 'object',
      properties: {}
    }
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries full burden for behavioral disclosure. It states the tool lists domains and their document counts, which implies a read-only operation, but doesn't address potential limitations like pagination, rate limits, authentication requirements, or whether the list is comprehensive versus filtered. This leaves significant gaps for a tool with zero annotation coverage.

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, efficient sentence that directly states the tool's function without any wasted words. It's front-loaded with the core action ('list all available domains') and adds only essential additional context ('and their document counts'). Every part of the sentence earns its place.

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 tool's simplicity (0 parameters, no output schema, no annotations), the description is adequate but has clear gaps. It explains what the tool does but lacks context about when to use it, behavioral constraints, or output format details. For a list operation with no structured guidance, this is the minimum viable description—it covers the basics but leaves important aspects unaddressed.

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

Parameters4/5

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

The input schema has 0 parameters with 100% coverage, so the schema fully documents that no inputs are required. The description doesn't need to add parameter information, and it appropriately doesn't mention any parameters. A baseline of 4 is applied for tools with zero parameters, as the description correctly focuses on the tool's purpose rather than unnecessary parameter details.

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 verb 'list' and the resource 'domains', specifying what the tool does. It adds useful context about including 'document counts' in the output. However, it doesn't explicitly differentiate from sibling tools like 'search-documents' or 'get-document-by-id', which prevents a perfect score.

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 like 'search-documents' or 'get-document-by-id'. It doesn't mention prerequisites, limitations, or specific contexts where listing all domains is appropriate versus searching for specific documents.

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/cskwork/keyword-rag-mcp'

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