Skip to main content
Glama
sisilet

Wayback Machine MCP Server

by sisilet

get_snapshots

Retrieve archived web page snapshots from the Wayback Machine by specifying URL, date range, and matching criteria to access historical website content.

Instructions

Get a list of available Wayback Machine snapshots for a URL. Dates use YYYYMMDD, match_type is one of: exact, prefix, host, domain.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
from_No
limitNo
match_typeNoexact
toNo
urlYes

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Implementation Reference

  • Registers the get_snapshots tool with FastMCP using @app.tool decorator, specifying name and description.
    @app.tool(
    	name="get_snapshots",
    	description=(
    		"Get a list of available Wayback Machine snapshots for a URL. "
    		"Dates use YYYYMMDD, match_type is one of: exact, prefix, host, domain."
    	),
    )
  • The main handler function for the get_snapshots tool. It builds CDX API parameters, fetches and parses the JSON response, processes snapshot rows into structured dicts, and returns the list of snapshots.
    async def get_snapshots(
    	url: str,
    	from_: Optional[str] = None,
    	to: Optional[str] = None,
    	limit: int = 100,
    	match_type: Literal["exact", "prefix", "host", "domain"] = "exact",
    ) -> Dict[str, Any]:
    	"""
    	List snapshots using the CDX API. Returns a structured result with a normalized list.
    	Parameter `from_` maps to `from` in the CDX API.
    	"""
    	params = _build_cdx_params(url, from_, to, limit, match_type)
    	raw = await _fetch_json(CDX_ENDPOINT, params)
    
    	if not isinstance(raw, list) or not raw:
    		return {"url": url, "snapshots": [], "count": 0}
    
    	headers = raw[0]
    	rows = raw[1:]
    
    	# Expected headers from CDX: urlkey,timestamp,original,mimetype,statuscode,digest,length
    	index_by_name = {name: idx for idx, name in enumerate(headers)}
    
    	results: List[Dict[str, Any]] = []
    	for row in rows:
    		try:
    			ts = row[index_by_name.get("timestamp", 1)]
    			orig = row[index_by_name.get("original", 2)]
    			mime = row[index_by_name.get("mimetype", 3)]
    			status = row[index_by_name.get("statuscode", 4)]
    			digest = row[index_by_name.get("digest", 5)]
    			length = row[index_by_name.get("length", 6)]
    			archived_url = f"{WAYBACK_ENDPOINT}/{ts}/{orig}"
    			results.append(
    				{
    					"timestamp": ts,
    					"original_url": orig,
    					"mimetype": mime,
    					"statuscode": status,
    					"digest": digest,
    					"length": length,
    					"archived_url": archived_url,
    				}
    			)
    		except Exception:
    			# Skip malformed rows
    			continue
    
    	return {"url": url, "snapshots": results, "count": len(results)}
  • Helper function used by get_snapshots to construct the parameters dictionary for the CDX API query.
    def _build_cdx_params(
    	url: str,
    	from_date: Optional[str],
    	to_date: Optional[str],
    	limit: int,
    	match_type: Literal["exact", "prefix", "host", "domain"],
    ) -> Dict[str, Any]:
    	params: Dict[str, Any] = {
    		"url": url,
    		"output": "json",
    		"limit": str(limit),
    		"matchType": match_type,
    		# Clean results a bit:
    		"filter": "statuscode:200",
    		"collapse": "digest",
    	}
    	if from_date:
    		params["from"] = from_date
    	if to_date:
    		params["to"] = to_date
    	return params
  • Helper function used by get_snapshots to fetch JSON data from the CDX API endpoint.
    async def _fetch_json(url: str, params: Dict[str, Any]) -> Any:
    	async with httpx.AsyncClient(
    		headers={"User-Agent": USER_AGENT},
    		timeout=httpx.Timeout(20.0),
    		follow_redirects=True,
    	) as client:
    		resp = await client.get(url, params=params)
    		resp.raise_for_status()
    		return resp.json()
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 mentions that the tool retrieves a 'list of available snapshots', implying a read-only operation, but doesn't cover important aspects like rate limits, authentication needs, pagination behavior, error handling, or what 'available' means in practice. The description adds minimal behavioral context beyond the basic action.

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 a single, efficient sentence that front-loads the core purpose and follows with essential parameter details. There's no wasted text, and it's appropriately sized for a tool with multiple parameters. However, it could be slightly more structured by separating usage guidance from parameter semantics.

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 the tool's moderate complexity (5 parameters, no annotations, but with an output schema), the description is minimally adequate. It covers the basic action and some parameter details, but lacks usage guidelines, behavioral context, and full parameter explanations. The presence of an output schema reduces the need to describe return values, but overall completeness is limited.

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 description adds some semantic value by explaining date formats ('YYYYMMDD') and match_type options, which aren't covered in the schema (0% description coverage). However, it doesn't explain the purpose of 'from_', 'to', or 'limit' parameters, or how they interact with the URL and match_type. With 5 parameters and low schema coverage, the description partially compensates but leaves significant gaps.

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 ('list of available Wayback Machine snapshots for a URL'), making the purpose specific and understandable. However, it doesn't explicitly distinguish this tool from sibling tools like 'get_archived_page' or 'search_items', which likely have related but different functions in the Wayback Machine context.

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 like 'get_archived_page' or 'search_items'. It mentions date formats and match_type values, but these are parameter details rather than usage context. There's no indication of prerequisites, constraints, or typical scenarios for selecting this tool.

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/sisilet/wayback-mcp'

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