MPEP Search Skill
Search MPEP corpus through hybrid RAG (FAISS vector + BM25 keyword + HyDE + cross-encoder reranking).
Sources:
- MPEP: Manual of Patent Examining Procedure
- 35 USC: United States Code Title 35
- 37 CFR: Code of Federal Regulations Title 37
- Subsequent Publications: Federal Register updates (post-Jan 2024)
Core Operations
1. search_mpep
Inputs:
query (string, required): Search query (minimum 3 characters)
top_k (int, optional): Number of results (default: 5, max: 20)
retrieve_k (int | None, optional): Candidates before reranking (default: top_k * 4, max: 100)
source_filter (string | None, optional): Filter by source ("MPEP", "35_USC", "37_CFR", "SUBSEQUENT", or None)
is_statute (bool | None, optional): Filter for statute content
is_regulation (bool | None, optional): Filter for regulation content
is_update (bool | None, optional): Filter for recent updates
Outputs:
{
"rank": int,
"source": str,
"section": str,
"file": str,
"page": int,
"has_statute": bool,
"has_mpep_ref": bool,
"has_rule_ref": bool,
"is_statute": bool,
"is_regulation": bool,
"is_update": bool,
"relevance_score": float,
"text": str,
# Optional for SUBSEQUENT:
"doc_type": str,
"fr_citation": str,
"effective_date": str
}
Examples:
# Basic search
search_mpep("enablement requirement 35 USC 112", top_k=5)
# Search only statutes
search_mpep("written description", top_k=10, is_statute=True)
# Search recent updates
search_mpep("AI inventorship", is_update=True)
# Filter by source
search_mpep("fee schedule", source_filter="37_CFR")
2. get_mpep_section
Retrieve all content from specific MPEP section.
Inputs:
section_number (string, required): MPEP section number (e.g., "2100", "608.01")
max_chunks (int, optional): Maximum chunks to return (default: 50)
Outputs:
{
"section": str,
"total_chunks": int,
"chunks": [
{
"text": str,
"metadata": {
"source": str,
"file": str,
"page": int,
"section": str,
"has_statute": bool,
"has_mpep_ref": bool,
"has_rule_ref": bool,
"is_statute": bool,
"is_regulation": bool,
"is_update": bool
}
}
]
}
Error Response:
{"error": "No content found for MPEP section {section_number}"}
Examples:
# Get MPEP 2100 (Patentability)
get_mpep_section("2100", max_chunks=50)
# Get subsection
get_mpep_section("608.01")
Input Validation
Query validation:
- Minimum 3 characters
- Case-insensitive
- No empty/whitespace-only queries
Section number validation:
- Numeric with optional decimal (e.g., "100", "2100", "608.01")
Limits:
top_k capped at 20
retrieve_k capped at 100
Implementation Notes
Index Location:
- FAISS index:
mcp_server/index/mpep_index.faiss
- Metadata:
mcp_server/index/mpep_metadata.json
- BM25 index:
mcp_server/index/mpep_bm25.json
Search Architecture:
- HyDE Query Expansion (hypothetical documents)
- Hybrid Retrieval (FAISS vector + BM25 keyword via RRF)
- Cross-Encoder Reranking (final relevance scores)
- Metadata Filtering (source/type filters)
Dependencies:
- sentence-transformers (BGE-base-en-v1.5)
- FAISS (vector search)
- rank-bm25 (keyword search)
- Cross-encoder (reranking)
- HyDE (optional, graceful degradation)
Error Handling:
- Clear error messages for missing index/invalid queries
- Graceful degradation if HyDE fails
- Input validation before processing
1---2name: mpep-search3description: Expert system for searching USPTO MPEP, 35 USC statutes, 37 CFR regulations, and post-Jan 2024 updates.4---5
6# MPEP Search Skill
7
8Search MPEP corpus through hybrid RAG (FAISS vector + BM25 keyword + HyDE + cross-encoder reranking).
9
10**Sources:**
11- MPEP: Manual of Patent Examining Procedure
12- 35 USC: United States Code Title 35
13- 37 CFR: Code of Federal Regulations Title 37
14- Subsequent Publications: Federal Register updates (post-Jan 2024)
15
16## Core Operations
17
18### 1. `search_mpep`
19
20**Inputs:**
21- `query` (string, required): Search query (minimum 3 characters)
22- `top_k` (int, optional): Number of results (default: 5, max: 20)
23- `retrieve_k` (int | None, optional): Candidates before reranking (default: top_k * 4, max: 100)
24- `source_filter` (string | None, optional): Filter by source (`"MPEP"`, `"35_USC"`, `"37_CFR"`, `"SUBSEQUENT"`, or `None`)
25- `is_statute` (bool | None, optional): Filter for statute content
26- `is_regulation` (bool | None, optional): Filter for regulation content
27- `is_update` (bool | None, optional): Filter for recent updates
28
29**Outputs:**
30```python
31{
32 "rank": int,
33 "source": str,
34 "section": str,
35 "file": str,
36 "page": int,
37 "has_statute": bool,
38 "has_mpep_ref": bool,
39 "has_rule_ref": bool,
40 "is_statute": bool,
41 "is_regulation": bool,
42 "is_update": bool,
43 "relevance_score": float,
44 "text": str,
45 # Optional for SUBSEQUENT:
46 "doc_type": str,
47 "fr_citation": str,
48 "effective_date": str
49}
50```
51
52**Examples:**
53```python
54# Basic search
55search_mpep("enablement requirement 35 USC 112", top_k=5)
56
57# Search only statutes
58search_mpep("written description", top_k=10, is_statute=True)
59
60# Search recent updates
61search_mpep("AI inventorship", is_update=True)
62
63# Filter by source
64search_mpep("fee schedule", source_filter="37_CFR")
65```
66
67### 2. `get_mpep_section`
68
69Retrieve all content from specific MPEP section.
70
71**Inputs:**
72- `section_number` (string, required): MPEP section number (e.g., `"2100"`, `"608.01"`)
73- `max_chunks` (int, optional): Maximum chunks to return (default: 50)
74
75**Outputs:**
76```python
77{
78 "section": str,
79 "total_chunks": int,
80 "chunks": [
81 {
82 "text": str,
83 "metadata": {
84 "source": str,
85 "file": str,
86 "page": int,
87 "section": str,
88 "has_statute": bool,
89 "has_mpep_ref": bool,
90 "has_rule_ref": bool,
91 "is_statute": bool,
92 "is_regulation": bool,
93 "is_update": bool
94 }
95 }
96 ]
97}
98```
99
100**Error Response:**
101```python
102{"error": "No content found for MPEP section {section_number}"}
103```
104
105**Examples:**
106```python
107# Get MPEP 2100 (Patentability)
108get_mpep_section("2100", max_chunks=50)
109
110# Get subsection
111get_mpep_section("608.01")
112```
113
114## Input Validation
115
116**Query validation:**
117- Minimum 3 characters
118- Case-insensitive
119- No empty/whitespace-only queries
120
121**Section number validation:**
122- Numeric with optional decimal (e.g., "100", "2100", "608.01")
123
124**Limits:**
125- `top_k` capped at 20
126- `retrieve_k` capped at 100
127
128## Implementation Notes
129
130**Index Location:**
131- FAISS index: `mcp_server/index/mpep_index.faiss`
132- Metadata: `mcp_server/index/mpep_metadata.json`
133- BM25 index: `mcp_server/index/mpep_bm25.json`
134
135**Search Architecture:**
1361. HyDE Query Expansion (hypothetical documents)
1372. Hybrid Retrieval (FAISS vector + BM25 keyword via RRF)
1383. Cross-Encoder Reranking (final relevance scores)
1394. Metadata Filtering (source/type filters)
140
141**Dependencies:**
142- sentence-transformers (BGE-base-en-v1.5)
143- FAISS (vector search)
144- rank-bm25 (keyword search)
145- Cross-encoder (reranking)
146- HyDE (optional, graceful degradation)
147
148**Error Handling:**
149- Clear error messages for missing index/invalid queries
150- Graceful degradation if HyDE fails
151- Input validation before processing