Skip to main content
Glama
VKneider

Slice.js Documentation MCP

by VKneider

get_doc_content

Retrieve full documentation content from Slice.js GitHub repository to access specific pages or complete bundles for AI assistant context.

Instructions

Fetches full content of specific doc page(s)

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
doc_idYes
include_metadataNo

Implementation Reference

  • Main tool definition with the execute function that fetches doc content by doc_id(s). Handles initialization, iterates through doc IDs, retrieves content, and optionally includes metadata.
    export const getDocContentTool = {
      name: "get_doc_content",
      description: "Fetches full content of specific doc page(s)",
      parameters: z.object({
        doc_id: z.union([z.string(), z.array(z.string())]),
        include_metadata: z.boolean().optional().default(false),
      }),
      execute: async (args: { doc_id: string | string[]; include_metadata: boolean }) => {
        if (!isInitialized) await initializeDocsStructure();
        const { doc_id, include_metadata } = args;
        const ids = Array.isArray(doc_id) ? doc_id : [doc_id];
        const results: any[] = [];
    
        for (const id of ids) {
          const doc = DOCS_STRUCTURE.find(d => d.id === id);
          if (!doc) continue;
    
          const content = await fetchDocContent(id);
          if (!content) continue;
    
          const result: any = {
            doc_id: id,
            title: doc.title,
            content,
          };
    
          if (include_metadata) {
            result.metadata = {
              path: doc.path,
              fetched_at: new Date().toISOString(),
            };
          }
    
          results.push(result);
        }
    
        return JSON.stringify(results.length === 1 ? results[0] : results);
      },
    };
  • Zod schema defining tool parameters: doc_id (string or array of strings) and optional include_metadata boolean flag.
    parameters: z.object({
      doc_id: z.union([z.string(), z.array(z.string())]),
      include_metadata: z.boolean().optional().default(false),
    }),
  • src/index.ts:6-16 (registration)
    Tool import and registration with the FastMCP server. The getDocContentTool is added to the server to make it available as an MCP tool.
    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);
    server.addTool(searchDocsTool);
    server.addTool(getDocContentTool);
  • Core helper function that fetches document content from GitHub using the doc_id. Implements caching to avoid redundant requests and handles errors gracefully.
    export async function fetchDocContent(docId: string): Promise<string | null> {
      const cached = getCached(docId);
      if (cached) {
        console.error(`[MCP] Cache hit for doc: ${docId}`);
        return cached;
      }
    
        console.error(`[MCP] Cache miss for doc: ${docId}, fetching from GitHub`);
      const doc = DOCS_STRUCTURE.find(d => d.id === docId);
      if (!doc) return null;
    
      const url = `${BASE_URL}${doc.path}`;
      try {
        const response = await fetch(url);
        if (!response.ok) throw new Error(`HTTP ${response.status}`);
        const content = await response.text();
        setCache(docId, content);
        console.error(`[MCP] Fetched and cached doc: ${docId}`);
        return content;
      } catch (error) {
        console.error(`[MCP] Error fetching ${url}:`, error);
        return null;
      }
    }
  • Initialization function that populates DOCS_STRUCTURE from the llm.txt file. Uses caching and handles initialization state to avoid redundant setup.
    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 = [];
      }
    }
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 fetching 'full content' but lacks details on permissions required, rate limits, error handling, or whether this is a read-only operation. For a tool with no annotation coverage, this leaves significant gaps in understanding its behavior.

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 with zero waste. It's front-loaded with the core purpose, making it easy to scan and understand quickly. Every word earns its place without unnecessary elaboration.

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

Completeness2/5

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

Given the complexity (2 parameters, no output schema, no annotations), the description is incomplete. It doesn't cover parameter details, return values, or behavioral traits like safety or performance. For a tool that fetches content, more context on output format or limitations would be helpful to compensate for the lack of structured data.

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

Parameters2/5

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

Schema description coverage is 0%, so the description must compensate for undocumented parameters. It implies 'doc_id' is used to specify pages but doesn't explain its format or that it can be a single string or array. It doesn't mention 'include_metadata' at all, leaving a key parameter undocumented. The description adds minimal value beyond the schema.

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 action ('fetches') and resource ('full content of specific doc page(s)'), making the purpose immediately understandable. It doesn't explicitly distinguish from sibling tools like 'list_docs' or 'search_docs', but the specificity of 'full content' versus listing or searching provides some implicit differentiation.

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 'list_docs' or 'search_docs'. It doesn't mention prerequisites, such as needing a valid doc_id, or contextual factors like performance implications for fetching multiple pages. Usage is implied but not explicitly stated.

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