You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/5.advanced/7.mcp.md
+15-21Lines changed: 15 additions & 21 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -151,7 +151,9 @@ This tool will:
151
151
152
152
### Using application context
153
153
154
-
You can use the application context the same way as in handlers and hooks. Use the `mcp.get_ctx()` function to get the context object.
154
+
You can use the application context the same way as in handlers and hooks with a few differences. There is a single context object per server process and it's not passed as a first argument to callbacks.
155
+
156
+
Use the `mcp.get_ctx()` function to get the context object.
155
157
156
158
```python [mcp/tools.py]
157
159
from dipdup import mcp
@@ -180,34 +182,26 @@ For a low-level access you can use `dipdup.mcp.server` singleton to interact wit
180
182
181
183
### Interacting with running indexer
182
184
183
-
DipDup provides [management API](../7.references/4.api.md) to interact with the running indexer. For example you can use it to add indexes in runtime. First, add running indexer as a HTTP datasource:
185
+
DipDup provides [management API](../7.references/4.api.md) to interact with the running indexer. For example you can use it to add indexes in runtime.
184
186
185
-
```yaml [dipdup.yaml]
186
-
datasources:
187
-
indexer:
188
-
kind: http
189
-
# NOTE: Default for Compose stack
190
-
url: http://api:46339
191
-
```
192
-
193
-
Then, call this datasource from your MCP tool:
187
+
You can use `ctx.call_api` to get nice plaintext output or `ctx.api` to access the datasource directly.
0 commit comments