Skip to main content
Glama
pinzonjulian

Turbo Docs MCP Server

by pinzonjulian

handbook-streams

Access Turbo Streams documentation for live updates, including 9 stream actions, WebSocket/SSE integration, and server-side template reuse.

Instructions

Turbo Streams for live updates - learn about the 9 stream actions (append, prepend, replace, update, remove, before, after, morph, refresh), WebSocket/SSE integration, and server-side template reuse

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The handler function for the "handbook-streams" tool. Reads the corresponding markdown file and returns its content as an MCP text content block or an error message.
    async () => {
      try {
        const content = await readMarkdownFile(path.join(folder, file));
        return {
          content: [
            {
              type: "text",
              text: content
            }
          ]
        };
      } catch (error) {
        const errorMessage = error instanceof Error ? error.message : String(error);
        return {
          content: [
            {
              type: "text",
              text: `Error reading ${file}: ${errorMessage}`
            }
          ]
        };
      }
    }
  • src/index.ts:17-45 (registration)
    Dynamic registration of the "handbook-streams" tool (and other doc tools) by iterating over docFiles config and calling server.tool with name, description, and shared handler.
    docFiles.forEach(({ folder, file, name, description }) => {
      server.tool(
        name,
        description,
        async () => {
          try {
            const content = await readMarkdownFile(path.join(folder, file));
            return {
              content: [
                {
                  type: "text",
                  text: content
                }
              ]
            };
          } catch (error) {
            const errorMessage = error instanceof Error ? error.message : String(error);
            return {
              content: [
                {
                  type: "text",
                  text: `Error reading ${file}: ${errorMessage}`
                }
              ]
            };
          }
        }
      );
    });
  • Configuration schema entry specific to the "handbook-streams" tool, defining its metadata and target file.
    {
      folder: 'handbook',
      file: '05_streams.md',
      name: 'handbook-streams',
      description: 'Turbo Streams for live updates - learn about the 9 stream actions (append, prepend, replace, update, remove, before, after, morph, refresh), WebSocket/SSE integration, and server-side template reuse'
    },
  • Helper function called by the tool handler to fetch the content of the target markdown file from GitHub raw (preferred, with caching), or local fallback.
    export async function readMarkdownFile(filename: string): Promise<string> {
      const filePath = path.join(docsFolder, filename);
      if (!filePath.startsWith(docsFolder)) {
        throw new Error("Invalid file path");
      }
      
      // Get current commit info if we don't have it yet
      if (!mainBranchInfo) {
        try {
          const commitInfo = await fetchMainBranchInformation();
          const cacheKey = `${commitInfo.sha.substring(0, 7)}-${commitInfo.timestamp}`;
          mainBranchInfo = {
            ...commitInfo,
            cacheKey
          };
        } catch (shaError) {
          console.error('Failed to get GitHub commit info, falling back to direct fetch');
        }
      }
      
      // Try to read from cache first if we have commit info
      if (mainBranchInfo) {
        const cachedFilePath = path.join(cacheFolder, mainBranchInfo.cacheKey, filename);
        try {
          const content = await fs.promises.readFile(cachedFilePath, "utf-8");
          console.error(`Using cached content for ${mainBranchInfo.cacheKey}: ${filename}`);
          return content;
        } catch (cacheError) {
          // Cache miss, continue to fetch from GitHub
        }
      }
      
      // Fetch from GitHub
      try {
        return await fetchFromGitHub(filename, mainBranchInfo?.cacheKey);
      } catch (githubError) {
        console.error(`GitHub fetch failed: ${githubError}, attempting to read from local files...`);
        
        // Fallback: read from local files
        try {
          return await fs.promises.readFile(filePath, "utf-8");
        } catch (localError) {
          const githubErrorMessage = githubError instanceof Error ? githubError.message : String(githubError);
          const localErrorMessage = localError instanceof Error ? localError.message : String(localError);
          throw new Error(`Failed to read file from GitHub (${githubErrorMessage}) and locally (${localErrorMessage})`);
        }
      }
    }
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 describes topics to 'learn about' but doesn't clarify if this tool retrieves documentation, demonstrates functionality, or performs another action. Key behavioral traits like whether it's read-only, requires authentication, or has side effects are completely missing, leaving the agent uncertain.

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

Conciseness3/5

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

The description is a single sentence listing topics, which is concise but not front-loaded with the tool's purpose. It wastes space on enumerating stream actions without first stating what the tool does. While not verbose, it lacks effective structure for guiding an agent.

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 lack of annotations and output schema, the description is incomplete. It fails to explain what the tool returns or how it behaves, leaving gaps in understanding its functionality. For a tool with no structured data to rely on, the description should provide more operational context but does not.

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 no parameter documentation is needed. The description doesn't add parameter details, which is appropriate here. A baseline of 4 is applied since the schema fully covers the absence of parameters, and the description doesn't need to compensate.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose2/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description lists topics ('Turbo Streams for live updates - learn about the 9 stream actions...') but does not specify what the tool actually does. It reads like a course syllabus rather than a functional description, failing to state a clear verb+resource action. The name 'handbook-streams' suggests it might provide documentation, but the description doesn't confirm this purpose.

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?

No guidance is provided on when to use this tool versus alternatives. The description mentions topics like 'WebSocket/SSE integration' but gives no indication of appropriate contexts, prerequisites, or exclusions. With sibling tools like 'handbook-introduction' and 'reference-streams', there's no differentiation to help an agent choose correctly.

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/pinzonjulian/turbo-docs-mcp-server'

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