Skip to main content
Glama
VKneider

Slice.js Documentation MCP

by VKneider

list_docs

Retrieve available documentation sections and categories from the Slice.js GitHub repository to navigate and access specific documentation content.

Instructions

Returns available documentation sections/categories

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The execute function for list_docs tool that initializes the docs structure if needed and returns a JSON string of available documentation sections with id, title, and path fields
    execute: async () => {
      if (!isInitialized) await initializeDocsStructure();
      return JSON.stringify(DOCS_STRUCTURE.map(doc => ({
        id: doc.id,
        title: doc.title,
        path: doc.path,
      })));
    },
  • Tool definition including name, description, and Zod schema for parameters (empty object), along with the execute handler
    export const listDocsTool = {
      name: "list_docs",
      description: "Returns available documentation sections/categories",
      parameters: z.object({}),
      execute: async () => {
        if (!isInitialized) await initializeDocsStructure();
        return JSON.stringify(DOCS_STRUCTURE.map(doc => ({
          id: doc.id,
          title: doc.title,
          path: doc.path,
        })));
      },
    };
  • src/index.ts:4-14 (registration)
    Import of listDocsTool from tools/list-docs.js and registration with the FastMCP server using server.addTool()
    import { listDocsTool } from "./tools/list-docs.js";
    import { searchDocsTool } from "./tools/search-docs.js";
    import { getDocContentTool } from "./tools/get-doc-content.js";
    import { getLlmFullContextTool } from "./tools/get-llm-full-context.js";
    
    const server = new FastMCP({
      name: "Slice.js Documentation MCP",
      version: "1.0.0",
    });
    
    server.addTool(listDocsTool);
  • initializeDocsStructure function that fetches and parses llm.txt to build the DOCS_STRUCTURE array, called by the list_docs handler if not already initialized
    export async function initializeDocsStructure(): Promise<void> {
      if (isInitialized) return;
    
      try {
        let llmContent = getCached('llm.txt');
        if (!llmContent) {
          console.error('[MCP] Fetching llm.txt to build docs structure');
          const url = `${BASE_URL}llm.txt`;
          const response = await fetch(url);
          if (!response.ok) throw new Error(`HTTP ${response.status}`);
          llmContent = await response.text();
          setCache('llm.txt', llmContent);
        } else {
          console.error('[MCP] Using cached llm.txt to build docs structure');
        }
        // Parse DOCS_STRUCTURE from llm.txt
        DOCS_STRUCTURE = parseDocsFromLlmTxt(llmContent);
        isInitialized = true;
        console.error(`[MCP] Initialized docs structure with ${DOCS_STRUCTURE.length} documents`);
      } catch (error) {
        console.error('[MCP] Failed to initialize docs structure:', error);
        DOCS_STRUCTURE = [];
      }
    }
  • parseDocsFromLlmTxt function that parses the llm.txt content to extract document metadata (id, path, title) for each documentation section
    export function parseDocsFromLlmTxt(content: string): DocItem[] {
      const items: DocItem[] = [];
      const sections = content.split(/\n=== /).slice(1);
    
      console.error(`[MCP] Parsing ${sections.length} sections from llm.txt`);
    
      for (const section of sections) {
        const lines = section.split('\n');
        const filePath = lines[0].replace(' ===', '');
        const docContent = lines.slice(1).join('\n').trim();
    
        if (filePath && docContent) {
          // Extract title from first # line
          const titleMatch = docContent.split('\n').find(line => line.startsWith('# '));
          const title = titleMatch ? titleMatch.replace('# ', '') : filePath.split('/').pop()?.replace('.md', '') || 'Untitled';
    
          const relativePath = filePath.replace(/^markdown\//, '');
          const id = relativePath.replace(/\.md$/, '');
    
          items.push({
            id,
            path: filePath,
            title,
          });
        } else {
          console.error(`[MCP] Skipped section from llm.txt: ${lines[0]}, has filePath: ${!!filePath}, docContent length: ${docContent.length}`);
        }
      }
    
      console.error(`[MCP] Parsed docs from llm.txt: ${items.map(i => i.path).join(', ')}`);
      return items;
    }
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 states the action ('Returns') but doesn't describe what 'available' means (e.g., all sections, filtered by permissions), the return format (e.g., list of strings, structured data), or any constraints (e.g., pagination, rate limits). This leaves significant gaps for a tool with no 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, making it easy to parse quickly.

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 has 0 parameters and no output schema, the description is minimally adequate but incomplete. It explains what the tool does at a high level but lacks details on behavior, return values, and differentiation from siblings. For a simple listing tool, this is the minimum viable, but it could benefit from more context to guide usage effectively.

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% description coverage, meaning no parameters need documentation. The description doesn't add parameter information, which is appropriate here. Baseline is 4 for 0 parameters, as there's nothing to compensate for, and the description doesn't introduce confusion.

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 ('Returns') and resource ('available documentation sections/categories'), making the purpose understandable. However, it doesn't explicitly differentiate from sibling tools like 'get_doc_content' or 'search_docs', which would require mentioning it's a listing/overview function rather than retrieving content or searching.

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. It doesn't mention that this tool is for browsing categories before accessing content with 'get_doc_content' or for when 'search_docs' is more appropriate for specific queries. Without such context, usage is implied but not explicit.

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/VKneider/slicejs-mcp'

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