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
You should see the JSON content with users and metadata. This demonstrates how MCP can read actual file structures.
306
+
307
+
### Step 4: See How MCP Improves Code Generation
308
+
309
+
Now that MCP can read your actual data file, try generating code that uses it:
310
+
311
+
```text
312
+
→ Create a module that processes the users in /tmp/city/data.json
313
+
```
314
+
315
+
**Without MCP:**
316
+
- Code would use guessed field names like `data["items"]`, `data["info"]`
317
+
- You'd need to manually fix field names to match your actual structure
318
+
319
+
**With MCP:**
320
+
- MCP reads the actual `data.json` file
321
+
- Sees real structure: `{"users": [...], "metadata": {...}}`
322
+
- Generates code with correct field names: `data["users"]`, `data["metadata"]`
323
+
- Uses actual user fields: `user["id"]`, `user["name"]`, `user["email"]`, `user["role"]`
324
+
- Code works immediately without manual fixes!
325
+
248
326
### Use it in natural-language requests
249
327
250
-
After you’ve confirmed `/mcp-call` works, you can ask things like:
328
+
After you've confirmed `/mcp-call` works, you can ask things like:
251
329
252
330
```text
253
331
→ Use the filesystem MCP to read `dspy_code/main.py` and
254
332
explain what this file does at a high level.
255
333
```
256
334
257
-
DSPy Code will use the MCP tools to fetch file contents and then let your model reason over them.
335
+
Or with the demo data:
336
+
337
+
```text
338
+
→ Create a sentiment analyzer for the user data in /tmp/city/data.json
339
+
```
340
+
341
+
DSPy Code will use the MCP tools to fetch file contents and then let your model reason over them, generating code that matches your actual data structure.
0 commit comments