Skip to main content
Glama
hendrickcastro

MCP ContentEngineering

content_get_raw

Retrieve raw Markdown content from files or directories without processing for AI models to access business rules, documentation, or knowledge bases exactly as written.

Instructions

Get raw markdown content without any processing. If source is a file, returns that file. If source is a directory, combines ALL .md files into one content with separators

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
file_pathNoNot used - content source is determined by CONTENT_SOURCE_TYPE and CONTENT_SOURCE_PATH environment variables

Implementation Reference

  • Core implementation of the `content_get_raw` tool handler. Reads raw content from a single file (CONTENT_SOURCE_TYPE='file') or concatenates all .md files from a directory (CONTENT_SOURCE_TYPE='directory') with file separators, returning content and metadata.
    export const mcp_content_get_raw = async (args: {
      file_path?: string;
    }): Promise<ToolResult<{
      content: string;
      source_info: string;
      total_files: number;
      size_bytes: number;
      last_modified: string;
    }>> => {
      try {
        const contentSourceType = process.env.CONTENT_SOURCE_TYPE || 'directory';
        const contentSourcePath = process.env.CONTENT_SOURCE_PATH;
        
        if (!contentSourcePath) {
          return {
            success: false,
            error: 'CONTENT_SOURCE_PATH not configured'
          };
        }
    
        if (contentSourceType === 'file') {
          // CASO 1: Archivo único - leer el archivo tal como está
          if (!await fs.pathExists(contentSourcePath)) {
            return {
              success: false,
              error: `File not found: ${contentSourcePath}`
            };
          }
    
          const stat = await fs.stat(contentSourcePath);
          if (!stat.isFile()) {
            return {
              success: false,
              error: `Path is not a file: ${contentSourcePath}`
            };
          }
    
          const content = await fs.readFile(contentSourcePath, 'utf-8');
          
          return {
            success: true,
            data: {
              content: content,
              source_info: `Single file: ${contentSourcePath}`,
              total_files: 1,
              size_bytes: stat.size,
              last_modified: stat.mtime.toISOString()
            }
          };
    
        } else {
          // CASO 2: Directorio - unir TODOS los archivos .md
          if (!await fs.pathExists(contentSourcePath)) {
            return {
              success: false,
              error: `Directory not found: ${contentSourcePath}`
            };
          }
    
          const stat = await fs.stat(contentSourcePath);
          if (!stat.isDirectory()) {
            return {
              success: false,
              error: `Path is not a directory: ${contentSourcePath}`
            };
          }
    
          // Buscar todos los archivos .md recursivamente
          const { globSync } = await import('glob');
          const markdownFiles = globSync('**/*.md', { 
            cwd: contentSourcePath,
            absolute: true,
            nodir: true
          });
    
          if (markdownFiles.length === 0) {
            return {
              success: false,
              error: `No .md files found in directory: ${contentSourcePath}`
            };
          }
    
          // Leer y concatenar todos los archivos .md
          let combinedContent = '';
          let totalSize = 0;
          let latestModified = new Date(0);
    
          for (const filePath of markdownFiles) {
            const fileContent = await fs.readFile(filePath, 'utf-8');
            const fileStat = await fs.stat(filePath);
            
            // Agregar separador y nombre del archivo
            const relativePath = path.relative(contentSourcePath, filePath);
            combinedContent += `\n\n<!-- ========== ARCHIVO: ${relativePath} ========== -->\n\n`;
            combinedContent += fileContent;
            
            totalSize += fileStat.size;
            if (fileStat.mtime > latestModified) {
              latestModified = fileStat.mtime;
            }
          }
    
          return {
            success: true,
            data: {
              content: combinedContent.trim(),
              source_info: `Combined ${markdownFiles.length} .md files from: ${contentSourcePath}`,
              total_files: markdownFiles.length,
              size_bytes: totalSize,
              last_modified: latestModified.toISOString()
            }
          };
        }
    
      } catch (error: any) {
        return {
          success: false,
          error: `Failed to get raw content: ${error.message}`
        };
      }
    };
  • Tool metadata and input schema definition for `content_get_raw`, used for tool listing and validation.
    export const MCP_CONTENT_TOOLS = [
      {
        name: "content_get_raw",
        description: "Get raw markdown content without any processing. If source is a file, returns that file. If source is a directory, combines ALL .md files into one content with separators",
        inputSchema: {
          type: "object",
          properties: {
            file_path: {
              type: "string",
              description: "Not used - content source is determined by CONTENT_SOURCE_TYPE and CONTENT_SOURCE_PATH environment variables"
            }
          },
          additionalProperties: false
        }
      }
  • src/server.ts:62-65 (registration)
    Registration of ListTools handler, which exposes the `content_get_raw` tool schema via MCP_CONTENT_TOOLS.
    // @ts-ignore - Bypass TypeScript errors from the SDK's types
    server.setRequestHandler(ListToolsRequestSchema, async () => ({
        tools: MCP_CONTENT_TOOLS
    }));
  • src/server.ts:95-100 (registration)
    Dispatch logic in CallTool handler that routes `content_get_raw` calls to the mcp_content_get_raw function from toolHandlers.
    case 'content_get_raw':
        logToFile(`[DEBUG] ✅ MATCH! Calling mcp_content_get_raw`);
        result = await toolHandlers.mcp_content_get_raw(input as any);
        logToFile(`[DEBUG] ✅ Result: ${JSON.stringify(result)}`);
        break;
    default:
  • Type definitions for ToolResult, used as return type in the handler for consistent success/error responses.
    export type ToolSuccessResult<T> = { success: true; data: T; };
    export type ToolErrorResult = { success: false; error: string; };
    export type ToolResult<T> = ToolSuccessResult<T> | ToolErrorResult;
Behavior3/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. It discloses key behavioral traits: returns raw markdown without processing, handles files and directories differently, and combines .md files with separators for directories. However, it lacks details on error handling, permissions, or output format specifics, leaving gaps in transparency.

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, with two sentences that efficiently convey core functionality. Every sentence adds value by explaining source handling and processing behavior, with no wasted words, though minor structural improvements could enhance clarity.

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 no annotations and no output schema, the description provides basic operational context but lacks completeness. It explains what the tool does but omits details on return values, error conditions, or dependencies like environment variables, making it adequate but with clear gaps for a tool with behavioral complexity.

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?

Schema description coverage is 100%, so the schema already documents the single parameter. The description adds no parameter-specific semantics beyond what the schema provides, such as clarifying how 'file_path' interacts with environment variables. Baseline 3 is appropriate as the schema handles parameter documentation adequately.

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 'get' and resource 'raw markdown content', specifying it returns content without processing. It distinguishes between file and directory sources, though there are no sibling tools to differentiate from. The purpose is specific but lacks sibling comparison context.

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 implies usage by explaining behavior for file vs. directory sources, but does not explicitly state when to use this tool versus alternatives. With no sibling tools provided, it cannot offer comparative guidance, leaving usage context partially implied rather than fully articulated.

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/hendrickcastro/MCPContentEngineering'

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