Skip to main content
Glama

search_patents

Search the SureChEMBL database for patents using text, keywords, or identifiers to find relevant chemical patent information.

Instructions

Search patents by text, keywords, or identifiers in SureChEMBL database

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
queryYesSearch query (keywords, patent numbers, or text)
limitNoNumber of results to return (1-1000, default: 25)
offsetNoNumber of results to skip (default: 0)

Implementation Reference

  • The handler function that implements the core logic for the 'search_patents' tool. It validates input arguments, performs a chemical name search via the SureChEMBL API as a proxy for patent search, and formats the response.
    private async handleSearchPatents(args: any) { if (!isValidSearchArgs(args)) { throw new McpError(ErrorCode.InvalidParams, 'Invalid search arguments'); } try { // SureChEMBL doesn't have a direct patent search endpoint, so we'll search chemicals and return patent context const response = await this.apiClient.get(`/chemical/name/${encodeURIComponent(args.query)}`); return { content: [ { type: 'text', text: JSON.stringify({ query: args.query, message: 'Patent search via chemical name lookup', results: response.data }, null, 2), }, ], }; } catch (error) { throw new McpError( ErrorCode.InternalError, `Failed to search patents: ${error instanceof Error ? error.message : 'Unknown error'}` ); } }
  • The JSON schema defining the input parameters for the 'search_patents' tool, including query (required), limit, and offset.
    inputSchema: { type: 'object', properties: { query: { type: 'string', description: 'Search query (keywords, patent numbers, or text)' }, limit: { type: 'number', description: 'Number of results to return (1-1000, default: 25)', minimum: 1, maximum: 1000 }, offset: { type: 'number', description: 'Number of results to skip (default: 0)', minimum: 0 }, }, required: ['query'], },
  • src/index.ts:544-545 (registration)
    The switch case in the CallToolRequestSchema handler that registers and dispatches calls to the 'search_patents' handler function.
    case 'search_patents': return await this.handleSearchPatents(args);
  • src/index.ts:340-352 (registration)
    The tool registration entry in the ListToolsRequestSchema response, defining name, description, and schema for 'search_patents'.
    { name: 'search_patents', description: 'Search patents by text, keywords, or identifiers in SureChEMBL database', inputSchema: { type: 'object', properties: { query: { type: 'string', description: 'Search query (keywords, patent numbers, or text)' }, limit: { type: 'number', description: 'Number of results to return (1-1000, default: 25)', minimum: 1, maximum: 1000 }, offset: { type: 'number', description: 'Number of results to skip (default: 0)', minimum: 0 }, }, required: ['query'], }, },
  • Helper function for validating the input arguments specifically for the search_patents tool.
    const isValidSearchArgs = ( args: any ): args is { query: string; limit?: number; offset?: number } => { return ( typeof args === 'object' && args !== null && typeof args.query === 'string' && args.query.length > 0 && (args.limit === undefined || (typeof args.limit === 'number' && args.limit > 0 && args.limit <= 1000)) && (args.offset === undefined || (typeof args.offset === 'number' && args.offset >= 0)) ); };

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/Augmented-Nature/SureChEMBL-MCP-Server'

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