Skip to main content
Glama
Fabien-desablens

MCP Webpage Timestamps

batch_extract_timestamps

Extract creation, modification, and publication timestamps from multiple webpages simultaneously using HTML meta tags, HTTP headers, and structured data.

Instructions

Extract timestamps from multiple webpages in batch

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
urlsYesArray of URLs to extract timestamps from
configNoOptional configuration for the extraction

Implementation Reference

  • Handler for the 'batch_extract_timestamps' tool. Parses arguments, validates URLs array, instantiates TimestampExtractor with optional config, concurrently extracts timestamps from each URL using Promise.allSettled, processes results including errors, and returns JSON-formatted array of results.
    if (name === 'batch_extract_timestamps') {
      const { urls, config } = args as {
        urls: string[];
        config?: {
          timeout?: number;
          userAgent?: string;
          followRedirects?: boolean;
          maxRedirects?: number;
          enableHeuristics?: boolean;
        };
      };
    
      if (!Array.isArray(urls) || urls.length === 0) {
        return {
          content: [
            {
              type: 'text',
              text: 'Error: URLs array is required and must not be empty',
            },
          ],
          isError: true,
        };
      }
    
      const timestampExtractor = config ? new TimestampExtractor(config) : extractor;
      const results = await Promise.allSettled(
        urls.map(url => timestampExtractor.extractTimestamps(url))
      );
    
      const processedResults = results.map((result, index) => {
        if (result.status === 'fulfilled') {
          return result.value;
        } else {
          return {
            url: urls[index],
            sources: [],
            confidence: 'low' as const,
            errors: [`Failed to extract timestamps: ${result.reason}`],
          };
        }
      });
    
      return {
        content: [
          {
            type: 'text',
            text: JSON.stringify(processedResults, null, 2),
          },
        ],
      };
    }
  • src/index.ts:67-109 (registration)
    Registration of the 'batch_extract_timestamps' tool in the tools array returned by ListToolsRequestHandler, including detailed input schema for batch processing.
    {
      name: 'batch_extract_timestamps',
      description: 'Extract timestamps from multiple webpages in batch',
      inputSchema: {
        type: 'object',
        properties: {
          urls: {
            type: 'array',
            items: {
              type: 'string',
            },
            description: 'Array of URLs to extract timestamps from',
          },
          config: {
            type: 'object',
            description: 'Optional configuration for the extraction',
            properties: {
              timeout: {
                type: 'number',
                description: 'Request timeout in milliseconds (default: 10000)',
              },
              userAgent: {
                type: 'string',
                description: 'User agent string to use for requests',
              },
              followRedirects: {
                type: 'boolean',
                description: 'Whether to follow HTTP redirects (default: true)',
              },
              maxRedirects: {
                type: 'number',
                description: 'Maximum number of redirects to follow (default: 5)',
              },
              enableHeuristics: {
                type: 'boolean',
                description: 'Whether to enable heuristic timestamp detection (default: true)',
              },
            },
          },
        },
        required: ['urls'],
      },
    },
  • Input schema definition for the 'batch_extract_timestamps' tool, specifying required 'urls' array and optional 'config' object.
    inputSchema: {
      type: 'object',
      properties: {
        urls: {
          type: 'array',
          items: {
            type: 'string',
          },
          description: 'Array of URLs to extract timestamps from',
        },
        config: {
          type: 'object',
          description: 'Optional configuration for the extraction',
          properties: {
            timeout: {
              type: 'number',
              description: 'Request timeout in milliseconds (default: 10000)',
            },
            userAgent: {
              type: 'string',
              description: 'User agent string to use for requests',
            },
            followRedirects: {
              type: 'boolean',
              description: 'Whether to follow HTTP redirects (default: true)',
            },
            maxRedirects: {
              type: 'number',
              description: 'Maximum number of redirects to follow (default: 5)',
            },
            enableHeuristics: {
              type: 'boolean',
              description: 'Whether to enable heuristic timestamp detection (default: true)',
            },
          },
        },
      },
      required: ['urls'],
    },
  • Helper method in TimestampExtractor class that implements the core logic for extracting timestamps from a single webpage, used by both 'extract_timestamps' and 'batch_extract_timestamps' tools.
    async extractTimestamps(url: string): Promise<TimestampResult> {
      const errors: string[] = [];
      let fetchResult: FetchResult;
    
      try {
        fetchResult = await this.fetchPage(url);
      } catch (error) {
        return {
          url,
          sources: [],
          confidence: 'low',
          errors: [`Failed to fetch page: ${error instanceof Error ? error.message : String(error)}`],
        };
      }
    
      const $ = cheerio.load(fetchResult.html);
      const sources: TimestampSource[] = [];
    
      // Extract timestamps from various sources
      sources.push(...this.extractFromHtmlMeta($));
      sources.push(...this.extractFromHttpHeaders(fetchResult.headers));
      sources.push(...this.extractFromJsonLd($));
      sources.push(...this.extractFromMicrodata($));
      sources.push(...this.extractFromOpenGraph($));
      sources.push(...this.extractFromTwitterCards($));
      
      if (this.config.enableHeuristics) {
        sources.push(...this.extractFromHeuristics($));
      }
    
      const result = this.consolidateTimestamps(url, sources);
      
      if (errors.length > 0) {
        result.errors = errors;
      }
    
      return result;
    }
Behavior2/5

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

With no annotations provided, the description carries the full burden of behavioral disclosure. It states what the tool does but fails to describe critical behaviors: it doesn't mention error handling (e.g., what happens if some URLs fail), rate limits, authentication requirements, output format, or whether the operation is idempotent. For a batch web scraping tool with zero annotation coverage, this is a significant gap that leaves the agent guessing about practical usage constraints.

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 front-loads the core functionality ('Extract timestamps from multiple webpages in batch') with zero wasted words. It immediately communicates the key differentiator (batch processing) without unnecessary elaboration. Every word earns its place, making it easy for an agent to parse and understand the tool's scope quickly.

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 of a batch web scraping tool with no annotations and no output schema, the description is incomplete. It doesn't explain what the output looks like (e.g., array of results per URL, error formats), behavioral aspects like concurrency or retries, or how it differs meaningfully from the sibling tool beyond the obvious 'batch' vs 'single'. For a tool that likely involves network requests and data extraction, more context is needed for effective agent use.

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?

The input schema has 100% description coverage, with detailed documentation for both the 'urls' array and nested 'config' object parameters. The description adds no parameter-specific information beyond what's in the schema, so it doesn't enhance understanding of parameter meanings or usage. However, since schema coverage is high, the baseline score of 3 is appropriate as the schema does the heavy lifting for parameter documentation.

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 ('extract timestamps') and resource ('from multiple webpages in batch'), making the purpose immediately understandable. It distinguishes from the sibling tool 'extract_timestamps' by specifying 'multiple webpages in batch', indicating this is a bulk operation rather than single-page extraction. However, it doesn't specify what format the timestamps will be in or what constitutes a 'timestamp' (e.g., publication dates, modification times, or embedded temporal data).

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 context through 'multiple webpages in batch', suggesting this tool is for bulk processing rather than single URLs, which differentiates it from the sibling 'extract_timestamps'. However, it lacks explicit guidance on when to use this tool versus the sibling (e.g., performance trade-offs, error handling differences) or any prerequisites (e.g., URL accessibility, authentication needs). The guidance is present but minimal and not comprehensive.

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/Fabien-desablens/mcp-webpage-timestamps'

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