Skip to content

Commit fec9825

Browse files
committed
Add some more tags to sdk tools
and start the server without subscriptions/download tags
1 parent 8516355 commit fec9825

File tree

4 files changed

+46
-13
lines changed

4 files changed

+46
-13
lines changed

README.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,18 @@ To connect using GitHub Copilot, configure the `mcp.json` file (see [VSCode docs
8686
}
8787
```
8888

89+
### Customizing the tools
90+
If you'd like, you can enable or disable specific tools in the MCP server. For example, if you're only working with the orders tooling: You can start the server with just the that enabled:
91+
`--include-tags="orders"`
92+
93+
If you want to keep the defaults, but disable a certain tool, you can: `--exclude-tags="destinations"`
94+
95+
In order to disable more than one tool you can provide a comma separated list like:
96+
`--exclude-tags="destinations","moasics"`
97+
98+
By default, we have disabled download tools and the subscriptions tools, as we have found those tools don't work very well with LLMs at the moment.
99+
100+
89101
## Example queries
90102

91103
- Does Planet have any recent imagery over Puget Sound?

src/planet_mcp/main.py

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,6 @@
33
is installed, this is installed as an executable named planet-mcp.
44
"""
55

6-
# note - the mcp dev tooling (e.g. uv run fastmcp dev src/main.py)
7-
# wants to find a server object named `mcp` (or it won't work)
86
import argparse
97
from planet_mcp.server import init
108

@@ -19,7 +17,12 @@ def csv(value):
1917
# when using fastmcp inspector and other tools, we handle
2018
# extra args here (or else the parser barfs)
2119
parser.add_argument("args", nargs="*")
22-
parser.add_argument("--include-tags", type=csv, default=None)
20+
# default enable all tools, except download and subscriptions
21+
parser.add_argument(
22+
"--include-tags",
23+
type=csv,
24+
default={"data", "tiles", "orders", "destinations", "mosaics", "features"},
25+
)
2326
parser.add_argument("--exclude-tags", type=csv, default=None)
2427
parser.add_argument("--servers", type=csv, default=None)
2528
# similar to extra args, inspector adds this
@@ -28,6 +31,8 @@ def csv(value):
2831

2932

3033
args = parse_args()
34+
# note - the mcp dev tooling (e.g. uv run fastmcp dev src/main.py)
35+
# wants to find a server object named `mcp` (or it won't work)
3136
mcp = init(
3237
enabled_servers=args.servers,
3338
include_tags=args.include_tags,

src/planet_mcp/servers/sdk.py

Lines changed: 24 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,9 @@
99

1010
from pydantic import PydanticSchemaGenerationError
1111

12+
13+
# tools we don't want enabled at all.
14+
# they simply don't work well in an AI context.
1215
_DEFAULT_IGNORE = {
1316
"data_wait_asset",
1417
"orders_wait",
@@ -22,15 +25,20 @@
2225
"destinations_patch_destination",
2326
}
2427

28+
SDK_CLIENTS = [
29+
(planet.FeaturesClient, "features"),
30+
(planet.DataClient, "data"),
31+
(planet.OrdersClient, "orders"),
32+
(planet.SubscriptionsClient, "subscriptions"),
33+
(planet.MosaicsClient, "mosaics"),
34+
(planet.DestinationsClient, "destinations"),
35+
]
36+
2537

2638
def mcp() -> FastMCP:
2739
mcp = FastMCP("sdk")
28-
make_tools(mcp, planet.FeaturesClient, "features")
29-
make_tools(mcp, planet.DataClient, "data")
30-
make_tools(mcp, planet.OrdersClient, "orders")
31-
make_tools(mcp, planet.SubscriptionsClient, "subscriptions")
32-
make_tools(mcp, planet.MosaicsClient, "mosaics")
33-
make_tools(mcp, planet.DestinationsClient, "destinations")
40+
for client, prefix in SDK_CLIENTS:
41+
make_tools(mcp, client, prefix)
3442
return mcp
3543

3644

@@ -61,8 +69,16 @@ def make_tools(mcp: FastMCP, client_class: type, prefix: str):
6169
if sig.return_annotation is None:
6270
func = _return_wrapper(func)
6371

64-
if "download" in name:
65-
opts["tags"] = set("download")
72+
opts["tags"] = set()
73+
74+
for tag in ["download", "patch", "update"]:
75+
if tag in name:
76+
opts["tags"].add(tag)
77+
78+
# add tags based on sdk client
79+
for _, tag in SDK_CLIENTS:
80+
if tag in full_name:
81+
opts["tags"].add(tag)
6682

6783
try:
6884
mcp.tool(func, name=full_name, **opts)

src/planet_mcp/servers/tiles.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
mcp = FastMCP("tiles")
1111

1212

13-
@mcp.tool
13+
@mcp.tool(tags={"tiles", "scene"})
1414
async def get_scene_tile(
1515
item_type: Annotated[str, Field(pattern=r"^\w+$")],
1616
item_id: Annotated[str, Field(pattern=r"^\w+$")],
@@ -48,7 +48,7 @@ async def get_scene_tile(
4848
)
4949

5050

51-
@mcp.tool
51+
@mcp.tool(tags={"tiles", "thumbnail"})
5252
async def get_scene_thumbnail(
5353
item_type: Annotated[str, Field(pattern=r"^\w+$")],
5454
item_id: Annotated[str, Field(pattern=r"^\w+$")],

0 commit comments

Comments
 (0)