Spaces:
Running
Running
Jeremiah Lowin commited on
Commit ·
b2bc1c1
1
Parent(s): 39b101f
Update composition.mdx
Browse files- docs/servers/composition.mdx +11 -7
docs/servers/composition.mdx
CHANGED
|
@@ -179,7 +179,7 @@ main_server.mount("remote", remote_proxy)
|
|
| 179 |
|
| 180 |
## Customizing Separators
|
| 181 |
|
| 182 |
-
Both `import_server()` and `mount()` allow you to customize the separators used for prefixing components
|
| 183 |
|
| 184 |
<CodeGroup>
|
| 185 |
|
|
@@ -187,9 +187,9 @@ Both `import_server()` and `mount()` allow you to customize the separators used
|
|
| 187 |
await main_mcp.import_server(
|
| 188 |
prefix="api",
|
| 189 |
app=some_subserver,
|
| 190 |
-
tool_separator="
|
| 191 |
-
resource_separator="
|
| 192 |
-
prompt_separator="
|
| 193 |
)
|
| 194 |
```
|
| 195 |
|
|
@@ -197,12 +197,16 @@ await main_mcp.import_server(
|
|
| 197 |
main_mcp.mount(
|
| 198 |
prefix="api",
|
| 199 |
app=some_subserver,
|
| 200 |
-
tool_separator="
|
| 201 |
-
resource_separator="
|
| 202 |
-
prompt_separator="
|
| 203 |
)
|
| 204 |
```
|
| 205 |
</CodeGroup>
|
| 206 |
<Warning>
|
| 207 |
Be cautious when choosing separators. Some MCP clients (like Claude Desktop) might have restrictions on characters allowed in tool names (e.g., `/` might not be supported). The defaults (`_` for names, `+` for URIs) are generally safe.
|
| 208 |
</Warning>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 179 |
|
| 180 |
## Customizing Separators
|
| 181 |
|
| 182 |
+
Both `import_server()` and `mount()` allow you to customize the separators used for prefixing components. The defaults are `_` for tools and prompts, and `+` for resources.
|
| 183 |
|
| 184 |
<CodeGroup>
|
| 185 |
|
|
|
|
| 187 |
await main_mcp.import_server(
|
| 188 |
prefix="api",
|
| 189 |
app=some_subserver,
|
| 190 |
+
tool_separator="_", # Tool name becomes: "api_sub_tool_name"
|
| 191 |
+
resource_separator="+", # Resource URI becomes: "api+data://sub_resource"
|
| 192 |
+
prompt_separator="_" # Prompt name becomes: "api_sub_prompt_name"
|
| 193 |
)
|
| 194 |
```
|
| 195 |
|
|
|
|
| 197 |
main_mcp.mount(
|
| 198 |
prefix="api",
|
| 199 |
app=some_subserver,
|
| 200 |
+
tool_separator="_", # Tool name becomes: "api_sub_tool_name"
|
| 201 |
+
resource_separator="+", # Resource URI becomes: "api+data://sub_resource"
|
| 202 |
+
prompt_separator="_" # Prompt name becomes: "api_sub_prompt_name"
|
| 203 |
)
|
| 204 |
```
|
| 205 |
</CodeGroup>
|
| 206 |
<Warning>
|
| 207 |
Be cautious when choosing separators. Some MCP clients (like Claude Desktop) might have restrictions on characters allowed in tool names (e.g., `/` might not be supported). The defaults (`_` for names, `+` for URIs) are generally safe.
|
| 208 |
</Warning>
|
| 209 |
+
|
| 210 |
+
<Tip>
|
| 211 |
+
To "cleanly" import or mount a server, set the prefix and all separators to `""` (empty string). This is generally unecessary but could save a couple tokens at the risk of a name collision!
|
| 212 |
+
</Tip>
|