Skip to main content
Glama
RossH121

Perplexity MCP Server

recency_filter

Set time windows for search results to focus on recent information. Choose hour, day, week, or month filters for time-sensitive queries like news and updates.

Instructions

Control the time window for search results. Essential for time-sensitive queries like news, updates, or recent developments. Filter persists until changed.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
filterYesTime window: 'hour' for breaking news, 'day' for daily updates, 'week' for recent developments, 'month' for broader recent context, 'none' to include all time periods

Implementation Reference

  • RecencyFilterHandler class that implements the core logic for the recency_filter tool: validates input arguments and delegates to FilterState to set the filter.
    export class RecencyFilterHandler {
    	constructor(private filterState: FilterState) {}
    
    	async handle(request: McpRequest) {
    		if (!isValidRecencyArgs(request.params.arguments)) {
    			throw ErrorHandler.createMcpError(
    				ErrorCode.InvalidParams,
    				"Invalid recency filter argument. Filter must be one of: hour, day, week, month, none."
    			);
    		}
    
    		const { filter } = request.params.arguments as RecencyArgs;
    		const resultMessage = this.filterState.setRecencyFilter(filter);
    
    		return {
    			content: [
    				{
    					type: "text",
    					text: resultMessage,
    				},
    			],
    		};
    	}
  • JSON schema definition for the recency_filter tool, including name, description, and input schema with enum validation.
    name: "recency_filter",
    description: "Control the time window for search results. Essential for time-sensitive queries like news, updates, or recent developments. Filter persists until changed.",
    inputSchema: {
    	type: "object",
    	properties: {
    		filter: {
    			type: "string",
    			enum: ["hour", "day", "week", "month", "none"],
    			description: "Time window: 'hour' for breaking news, 'day' for daily updates, 'week' for recent developments, 'month' for broader recent context, 'none' to include all time periods",
    		},
    	},
    	required: ["filter"],
    },
  • Registration of tool handlers in the MCP server's CallToolRequest handler, dispatching recency_filter to RecencyFilterHandler.handle()
    	switch (request.params.name) {
    		case "search":
    			return this.searchHandler.handle(request);
    		case "domain_filter":
    			return this.domainFilterHandler.handle(request);
    		case "recency_filter":
    			return this.recencyFilterHandler.handle(request);
    		case "clear_filters":
    			return this.filterManagementHandler.handleClearFilters();
    		case "list_filters":
    			return this.filterManagementHandler.handleListFilters();
    		case "model_info":
    			return this.modelInfoHandler.handle(request);
    		default:
    			throw new McpError(
    				ErrorCode.MethodNotFound,
    				`Unknown tool: ${request.params.name}`
    			);
    	}
    });
  • Instantiation of RecencyFilterHandler instance in PerplexityMcpServer constructor.
    this.recencyFilterHandler = new RecencyFilterHandler(this.filterState);
  • FilterState.setRecencyFilter method, which stores the recency filter value and generates the response message used by the handler.
    setRecencyFilter(filter: string): string {
    	if (filter === "none") {
    		this.recencyFilter = null;
    		return "Recency filter has been disabled. Searches will include results from any time period.";
    	}
    
    	this.recencyFilter = filter;
    	const timeDescription = {
    		hour: "hour",
    		day: "24 hours", 
    		week: "7 days",
    		month: "30 days"
    	}[filter] || filter;
    
    	return `Recency filter set to "${filter}". Searches will be limited to content from the last ${timeDescription}.`;
    }
Behavior3/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 reveals important behavioral traits: the filter persists until changed (stateful behavior), and it's for search results (context of application). However, it doesn't mention potential side effects, error conditions, or what happens when the filter is applied.

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 perfectly concise with three sentences that each earn their place: states the core function, provides usage context, and reveals important behavioral trait (persistence). No wasted words, front-loaded with the essential information.

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

Completeness4/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 (stateful filter setting), no annotations, and no output schema, the description does reasonably well. It explains what the tool does, when to use it, and a key behavioral aspect (persistence). However, it doesn't describe what the tool returns or potential error conditions, leaving some gaps in completeness.

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

Parameters4/5

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

With 100% schema description coverage and only 1 parameter, the schema already fully documents the parameter. The description adds some value by explaining why you'd use different time windows ('breaking news', 'daily updates', etc.), but doesn't provide additional syntax or format details beyond what's in the schema. For a single-parameter tool with excellent schema coverage, this is above baseline.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool's purpose with specific verbs ('Control the time window for search results') and distinguishes it from siblings by focusing on time-based filtering. It explicitly mentions what it does (sets a time window filter) rather than just restating the name.

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

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides clear context for when to use this tool ('Essential for time-sensitive queries like news, updates, or recent developments'), but doesn't explicitly mention when NOT to use it or name specific alternatives among the sibling tools. It implies usage scenarios but lacks explicit exclusions.

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/RossH121/perplexity-mcp'

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