Skip to main content
Glama
Fabien-desablens

MCP Webpage Timestamps

extract_timestamps

Extract creation, modification, and publication timestamps from webpage URLs using HTML meta tags, HTTP headers, and structured data.

Instructions

Extract creation, modification, and publication timestamps from a webpage

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
urlYesThe URL of the webpage to extract timestamps from
configNoOptional configuration for the extraction

Implementation Reference

  • Core handler function implementing the timestamp extraction logic: fetches webpage, parses with Cheerio, extracts from meta tags, headers, JSON-LD, microdata, OpenGraph, Twitter cards, heuristics, and consolidates results.
    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;
    }
  • src/index.ts:28-66 (registration)
    MCP tool registration defining name, description, and input schema for 'extract_timestamps'.
      name: 'extract_timestamps',
      description: 'Extract creation, modification, and publication timestamps from a webpage',
      inputSchema: {
        type: 'object',
        properties: {
          url: {
            type: 'string',
            description: 'The URL of the webpage 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: ['url'],
      },
    },
  • MCP CallToolRequestSchema handler branch for 'extract_timestamps': validates input, instantiates extractor if config provided, calls extractTimestamps, and returns JSON result.
    if (name === 'extract_timestamps') {
      const { url, config } = args as {
        url: string;
        config?: {
          timeout?: number;
          userAgent?: string;
          followRedirects?: boolean;
          maxRedirects?: number;
          enableHeuristics?: boolean;
        };
      };
    
      if (!url) {
        return {
          content: [
            {
              type: 'text',
              text: 'Error: URL is required',
            },
          ],
          isError: true,
        };
      }
    
      const timestampExtractor = config ? new TimestampExtractor(config) : extractor;
      const result = await timestampExtractor.extractTimestamps(url);
    
      return {
        content: [
          {
            type: 'text',
            text: JSON.stringify(result, null, 2),
          },
        ],
      };
    }
  • TypeScript interfaces defining the output structure (TimestampResult) and sources (TimestampSource) used by the tool.
    export interface TimestampResult {
      url: string;
      createdAt?: Date;
      modifiedAt?: Date;
      publishedAt?: Date;
      sources: TimestampSource[];
      confidence: 'high' | 'medium' | 'low';
      errors?: string[];
    }
    
    export interface TimestampSource {
      type: 'html-meta' | 'http-header' | 'json-ld' | 'microdata' | 'opengraph' | 'twitter' | 'heuristic';
      field: string;
      value: string;
      confidence: 'high' | 'medium' | 'low';
    }
  • Type definition for optional config input parameter.
    export interface ExtractorConfig {
      timeout?: number;
      userAgent?: string;
      followRedirects?: boolean;
      maxRedirects?: number;
      enableHeuristics?: boolean;
    }
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 states what the tool does but lacks details on error handling, rate limits, authentication needs, or output format. For a tool that interacts with external webpages, this is a significant gap 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.

Conciseness5/5

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

The description is a single, clear sentence that directly states the tool's purpose without unnecessary words. It is front-loaded and efficiently conveys the core functionality, earning a top score for conciseness.

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 no annotations and no output schema, the description is incomplete. It does not explain what the extracted timestamps look like, potential errors, or behavioral traits like network dependencies. For a tool with external interactions, this leaves critical gaps for an AI agent.

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 fully documents the parameters. The description does not add any semantic details beyond the schema, such as examples or edge cases. Baseline 3 is appropriate as the schema handles the heavy lifting.

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') and the resource ('timestamps from a webpage'), specifying the types of timestamps (creation, modification, publication). It distinguishes from the sibling tool 'batch_extract_timestamps' by implying this is for single URLs, though not explicitly stated. However, it lacks explicit sibling differentiation, keeping it at a 4.

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, such as the sibling 'batch_extract_timestamps' for multiple URLs. It does not mention prerequisites, exclusions, or specific contexts for usage, resulting in minimal guidance.

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