Query Patents
query_patentsSearch US patents by title, assignee, inventor, or CPC section. Filter by patent type and grant date range to find relevant patents.
Instructions
Search US patents from the USPTO PatentsView database. Filter by patent title, assignee organization, inventor name, CPC section, patent type, and grant date range. Source: USPTO PatentsView API, updated weekly.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| patent_title | No | Patent title keyword search (partial match) | |
| assignee | No | Assignee organization name (partial match, e.g. 'Google') | |
| inventor | No | Inventor name (partial match, e.g. 'Smith') | |
| cpc_section | No | CPC section letter (A=Human Necessities, B=Operations, C=Chemistry, D=Textiles, E=Fixed Constructions, F=Mechanical Engineering, G=Physics, H=Electricity) | |
| patent_type | No | Patent type: utility, design, plant, reissue | |
| date_from | No | Start date for patent grant (YYYY-MM-DD) | |
| date_to | No | End date for patent grant (YYYY-MM-DD) | |
| limit | No | Maximum results to return (default 25, max 100) |
Implementation Reference
- src/tools/patents.ts:78-109 (handler)The async handler function for the 'query_patents' tool. Accepts optional filters (patent_title, assignee, inventor, cpc_section, patent_type, date_from, date_to, limit), calls the Verilex API at /api/v1/patents, and returns formatted results.
async ({ patent_title, assignee, inventor, cpc_section, patent_type, date_from, date_to, limit }) => { const res = await apiGet<PatentQueryResponse>("/api/v1/patents", { patent_title, assignee, inventor, cpc_section, patent_type, date_from, date_to, limit: limit ?? 25, }); if (!res.ok) { return { content: [ { type: "text" as const, text: `API error (${res.status}): ${JSON.stringify(res.data)}`, }, ], isError: true, }; } const { count, data } = res.data; const summary = `Found ${count} patent(s).`; const json = JSON.stringify(data, null, 2); return { content: [{ type: "text" as const, text: `${summary}\n\n${json}` }], }; }, - src/tools/patents.ts:39-76 (schema)Input schema for query_patents defined with Zod. Optional fields: patent_title, assignee, inventor, cpc_section, patent_type, date_from, date_to, limit (default 25, max 100).
inputSchema: { patent_title: z .string() .optional() .describe("Patent title keyword search (partial match)"), assignee: z .string() .optional() .describe("Assignee organization name (partial match, e.g. 'Google')"), inventor: z .string() .optional() .describe("Inventor name (partial match, e.g. 'Smith')"), cpc_section: z .string() .optional() .describe("CPC section letter (A=Human Necessities, B=Operations, C=Chemistry, " + "D=Textiles, E=Fixed Constructions, F=Mechanical Engineering, G=Physics, H=Electricity)"), patent_type: z .string() .optional() .describe("Patent type: utility, design, plant, reissue"), date_from: z .string() .optional() .describe("Start date for patent grant (YYYY-MM-DD)"), date_to: z .string() .optional() .describe("End date for patent grant (YYYY-MM-DD)"), limit: z .number() .int() .min(1) .max(100) .optional() .describe("Maximum results to return (default 25, max 100)"), }, - src/tools/patents.ts:31-110 (registration)Registration of the 'query_patents' tool via server.registerTool() with its schema and handler callback.
server.registerTool( "query_patents", { title: "Query Patents", description: "Search US patents from the USPTO PatentsView database. Filter by patent title, " + "assignee organization, inventor name, CPC section, patent type, and grant date range. " + "Source: USPTO PatentsView API, updated weekly.", inputSchema: { patent_title: z .string() .optional() .describe("Patent title keyword search (partial match)"), assignee: z .string() .optional() .describe("Assignee organization name (partial match, e.g. 'Google')"), inventor: z .string() .optional() .describe("Inventor name (partial match, e.g. 'Smith')"), cpc_section: z .string() .optional() .describe("CPC section letter (A=Human Necessities, B=Operations, C=Chemistry, " + "D=Textiles, E=Fixed Constructions, F=Mechanical Engineering, G=Physics, H=Electricity)"), patent_type: z .string() .optional() .describe("Patent type: utility, design, plant, reissue"), date_from: z .string() .optional() .describe("Start date for patent grant (YYYY-MM-DD)"), date_to: z .string() .optional() .describe("End date for patent grant (YYYY-MM-DD)"), limit: z .number() .int() .min(1) .max(100) .optional() .describe("Maximum results to return (default 25, max 100)"), }, }, async ({ patent_title, assignee, inventor, cpc_section, patent_type, date_from, date_to, limit }) => { const res = await apiGet<PatentQueryResponse>("/api/v1/patents", { patent_title, assignee, inventor, cpc_section, patent_type, date_from, date_to, limit: limit ?? 25, }); if (!res.ok) { return { content: [ { type: "text" as const, text: `API error (${res.status}): ${JSON.stringify(res.data)}`, }, ], isError: true, }; } const { count, data } = res.data; const summary = `Found ${count} patent(s).`; const json = JSON.stringify(data, null, 2); return { content: [{ type: "text" as const, text: `${summary}\n\n${json}` }], }; }, ); - src/index.ts:18-18 (registration)Import of registerPatentTools from the patents module, which registers query_patents among other patent tools.
import { registerPatentTools } from "./tools/patents.js"; - src/client.ts:44-76 (helper)The apiGet helper function used by the query_patents handler to make HTTP GET requests to the Verilex API.
export async function apiGet<T = unknown>( path: string, params?: Record<string, string | number | undefined>, ): Promise<ApiResponse<T>> { const url = buildUrl(path, params); const headers: Record<string, string> = { Accept: "application/json", "User-Agent": "verilex-mcp-server/0.1.0", }; // Forward x402 payment token if present in env (for paid endpoints) const paymentToken = process.env.VERILEX_PAYMENT_TOKEN; if (paymentToken) { headers["X-Payment-Token"] = paymentToken; } const res = await fetch(url, { headers }); const data = (await res.json()) as T; const stale = res.headers.get("X-Data-Stale"); const lastUpdated = res.headers.get("X-Data-Last-Updated"); const ageSeconds = res.headers.get("X-Data-Age-Seconds"); return { ok: res.ok, status: res.status, data, stale: stale === "true", lastUpdated: lastUpdated ?? undefined, ageSeconds: ageSeconds ? Number(ageSeconds) : undefined, }; }