Skip to main content
Glama
FutureAtoms

Agentic Control Framework (ACF)

by FutureAtoms

read_url

Retrieve content from a web page by providing its URL. Specify a timeout to control request duration.

Instructions

Read URL

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
pathYes
timeoutNo

Implementation Reference

  • The main handler for read_url – readFileFromUrl fetches a URL via node-fetch, supports text, image, and binary content types, with timeout support.
    async function readFileFromUrl(url, options = {}) {
      try {
        // Validate URL
        let validUrl;
        try {
          validUrl = new URL(url);
        } catch (error) {
          return {
            success: false,
            message: `Invalid URL: ${url}`
          };
        }
        
        // Set timeout (default 30 seconds)
        const timeout = options.timeout || 30000;
        const controller = new AbortController();
        const timeoutId = setTimeout(() => controller.abort(), timeout);
        
        try {
          // Fetch the content
          const response = await fetch(url, {
            signal: controller.signal,
            headers: {
              'User-Agent': 'ACF-MCP/1.0'
            }
          });
          
          clearTimeout(timeoutId);
          
          if (!response.ok) {
            return {
              success: false,
              message: `HTTP error ${response.status}: ${response.statusText}`
            };
          }
          
          // Get content type
          const contentType = response.headers.get('content-type') || 'text/plain';
          const isText = contentType.startsWith('text/') || 
            contentType.includes('json') || 
            contentType.includes('xml') ||
            contentType.includes('javascript');
          
          // Handle different content types
          if (contentType.startsWith('image/')) {
            // Handle images
            const buffer = await response.buffer();
            
            // Convert to a format that can be displayed
            let processedBuffer = buffer;
            let processedType = contentType;
            
            // If it's a format that might not be supported, convert to JPEG
            if (!['image/jpeg', 'image/png', 'image/gif', 'image/webp'].includes(contentType.split(';')[0])) {
              try {
                processedBuffer = await sharp(buffer).jpeg().toBuffer();
                processedType = 'image/jpeg';
              } catch (sharpError) {
                logger.warn(`Could not process image with sharp: ${sharpError.message}`);
              }
            }
            
            return {
              success: true,
              content: processedBuffer.toString('base64'),
              mimeType: processedType,
              isText: false,
              isUrl: true,
              url: url,
              size: processedBuffer.length
            };
          } else if (isText) {
            // Handle text content
            const text = await response.text();
            
            return {
              success: true,
              content: text,
              mimeType: contentType,
              isText: true,
              isUrl: true,
              url: url,
              size: text.length
            };
          } else {
            // Handle binary content
            const buffer = await response.buffer();
            
            return {
              success: true,
              content: buffer.toString('base64'),
              mimeType: contentType,
              isText: false,
              isUrl: true,
              url: url,
              size: buffer.length
            };
          }
          
        } catch (fetchError) {
          if (fetchError.name === 'AbortError') {
            return {
              success: false,
              message: `Request timeout after ${timeout}ms`
            };
          }
          throw fetchError;
        }
        
      } catch (error) {
        logger.error(`Error reading from URL: ${error.message}`);
        return {
          success: false,
          message: `Failed to read from URL: ${error.message}`
        };
      }
    }
  • Tool registration: defines the 'read_url' tool name, description, and inputSchema (requires 'path', optional 'timeout').
    { name:'read_url', description:'Read URL', inputSchema:{ type:'object', properties:{ path:{type:'string'}, timeout:{type:'number'} }, required:['path'] } },
  • Dispatch: the case 'read_url' calls enhancedFsTools.readFileFromUrl(args.path, args).
    case 'read_url': data = await enhancedFsTools.readFileFromUrl(args.path, args); break;
  • readFileEnhanced – higher-level helper that delegates to readFileFromUrl when the path is a URL.
    async function readFileEnhanced(filePath, allowedDirs, options = {}) {
      try {
        // Check if it's a URL
        if (options.isUrl || (typeof filePath === 'string' && (filePath.startsWith('http://') || filePath.startsWith('https://')))) {
          return await readFileFromUrl(filePath, options);
        }
        
        // Otherwise, use the original readFile from filesystem_tools
        const filesystemTools = require('../filesystem_tools');
        return filesystemTools.readFile(filePath, allowedDirs);
        
      } catch (error) {
        logger.error(`Error in readFileEnhanced: ${error.message}`);
        return {
          success: false,
          message: error.message
        };
      }
    }
  • Test example generator: returns a sample path for read_url.
    case 'read_url': return { path: 'http://example.com' };
Behavior1/5

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

With no annotations, the description fails to disclose any behavioral traits such as network calls, authentication, or error handling; 'Read URL' implies a read but gives no further detail.

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

Conciseness2/5

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

The description is extremely concise at 2 words, but this is under-specification rather than effective conciseness; it lacks necessary detail.

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

Completeness1/5

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

Given the tool's potential complexity (network request with timeout) and lack of annotations or output schema, the description is completely inadequate for an agent to invoke correctly.

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

Parameters1/5

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

Schema coverage is 0% and the description does not explain the meaning of 'path' or 'timeout', leaving the parameters semantically opaque.

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 'Read URL' states a verb and resource but is vague; it does not distinguish from sibling tools like browser_navigate or read_file, and is nearly a tautology.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines1/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; there is no mention of prerequisites or context.

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/FutureAtoms/agentic-control-framework'

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