|
6 | 6 | - You can combine operation filtering with tag filtering (e.g., use `include_operations` with `include_tags`) |
7 | 7 | - When combining filters, a greedy approach will be taken. Endpoints matching either criteria will be included |
8 | 8 | """ |
9 | | -from examples.shared.apps.items import app |
10 | | -from examples.shared.setup import setup_logging |
11 | | - |
| 9 | +from examples.shared.items_app import app # The FastAPI app |
12 | 10 | from fastapi_mcp import FastApiMCP |
13 | 11 |
|
14 | | -setup_logging() |
15 | 12 |
|
16 | 13 | # Filter by including specific operation IDs |
17 | 14 | include_operations_mcp = FastApiMCP( |
18 | 15 | app, |
| 16 | + name="Item API MCP - Included Operations", |
19 | 17 | include_operations=["get_item", "list_items"], |
20 | 18 | ) |
21 | 19 |
|
22 | 20 | # Filter by excluding specific operation IDs |
23 | 21 | exclude_operations_mcp = FastApiMCP( |
24 | 22 | app, |
| 23 | + name="Item API MCP - Excluded Operations", |
25 | 24 | exclude_operations=["create_item", "update_item", "delete_item"], |
26 | 25 | ) |
27 | 26 |
|
28 | 27 | # Filter by including specific tags |
29 | 28 | include_tags_mcp = FastApiMCP( |
30 | 29 | app, |
| 30 | + name="Item API MCP - Included Tags", |
31 | 31 | include_tags=["items"], |
32 | 32 | ) |
33 | 33 |
|
34 | 34 | # Filter by excluding specific tags |
35 | 35 | exclude_tags_mcp = FastApiMCP( |
36 | 36 | app, |
| 37 | + name="Item API MCP - Excluded Tags", |
37 | 38 | exclude_tags=["search"], |
38 | 39 | ) |
39 | 40 |
|
40 | 41 | # Combine operation IDs and tags (include mode) |
41 | 42 | combined_include_mcp = FastApiMCP( |
42 | 43 | app, |
| 44 | + name="Item API MCP - Combined Include", |
43 | 45 | include_operations=["delete_item"], |
44 | 46 | include_tags=["search"], |
45 | 47 | ) |
|
0 commit comments