perplexity-mcp-server
Version:
A Perplexity API Model Context Protocol (MCP) server that unlocks Perplexity's search-augmented AI capabilities for LLM agents. Features robust error handling, secure input validation, and transparent reasoning with the showThinking parameter. Built with
35 lines (34 loc) • 972 B
TypeScript
import { z } from 'zod';
import { McpToolResponse } from './mcp.js';
import { OperationContext } from "../utils/requestContext.js";
/**
* Base interface for tool input parameters
*/
export interface BaseToolInput {
[key: string]: unknown;
}
/**
* Base interface for tool response content
*/
export interface BaseToolResponse {
[key: string]: unknown;
}
/**
* Interface for tool registration options
*/
export interface ToolRegistrationOptions<TInput extends BaseToolInput> {
/** Zod schema for input validation */
inputSchema: z.ZodType<TInput>;
/** Description of the tool */
description: string;
/** Example usage scenarios */
examples?: {
name: string;
input: TInput;
description?: string;
}[];
}
/**
* Interface for a tool handler function
*/
export type ToolHandler<TInput extends BaseToolInput, TResponse extends McpToolResponse> = (input: TInput, context: OperationContext) => Promise<TResponse>;