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: pyTigerGraph/mcp/MCP_README.md
+96-8Lines changed: 96 additions & 8 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -147,11 +147,10 @@ These operations manage individual graphs within the TigerGraph database. A data
147
147
-`tigergraph__clear_graph_data` - Clear all data from a graph (keeps schema structure)
148
148
149
149
### Schema Operations (Graph Level)
150
-
These operations work with the schema of a specific graph. Each graph has its own independent schema.
150
+
These operations work with the schema and objects of a specific graph.
151
151
152
-
-`tigergraph__get_graph_schema` - Get the schema of a specific graph (raw JSON)
153
-
-`tigergraph__describe_graph` - Get a human-readable description of a specific graph's schema
154
-
-`tigergraph__get_graph_metadata` - Get metadata about a specific graph (vertex types, edge types, queries, loading jobs)
152
+
-`tigergraph__get_graph_schema` - Get the schema of a specific graph as structured JSON (vertex/edge types and attributes only)
153
+
-`tigergraph__show_graph_details` - Show details of a graph: schema, queries, loading jobs, data sources. Use `detail_type` to filter (`schema`, `query`, `loading_job`, `data_source`) or omit for all
155
154
156
155
### Node Operations
157
156
-`tigergraph__add_node` - Add a single node
@@ -196,15 +195,20 @@ These operations work with the schema of a specific graph. Each graph has its ow
196
195
-`tigergraph__get_node_degree` - Get the degree (number of edges) of a node
197
196
198
197
### GSQL Operations
199
-
-`tigergraph__gsql` - Execute GSQL command
198
+
-`tigergraph__gsql` - Execute raw GSQL command
199
+
-`tigergraph__generate_gsql` - Generate a GSQL query from a natural language description (requires LLM configuration)
200
+
-`tigergraph__generate_cypher` - Generate an openCypher query from a natural language description (requires LLM configuration)
200
201
201
202
### Vector Schema Operations
202
203
-`tigergraph__add_vector_attribute` - Add a vector attribute to a vertex type (DIMENSION, METRIC: COSINE/L2/IP)
203
204
-`tigergraph__drop_vector_attribute` - Drop a vector attribute from a vertex type
205
+
-`tigergraph__list_vector_attributes` - List vector attributes (name, dimension, index type, data type, metric) by parsing `LS` output; optionally filter by vertex type
204
206
-`tigergraph__get_vector_index_status` - Check vector index rebuild status (Ready_for_query/Rebuild_processing)
205
207
206
208
### Vector Data Operations
207
209
-`tigergraph__upsert_vectors` - Upsert multiple vertices with vector data using REST API (batch support)
210
+
-`tigergraph__load_vectors_from_csv` - Bulk-load vectors from a CSV/delimited file via a GSQL loading job (creates job, runs with file, drops job)
211
+
-`tigergraph__load_vectors_from_json` - Bulk-load vectors from a JSON Lines (.jsonl) file via a GSQL loading job with `JSON_FILE="true"` (creates job, runs with file, drops job)
208
212
-`tigergraph__search_top_k_similarity` - Perform vector similarity search using `vectorSearch()` function
209
213
-`tigergraph__fetch_vector` - Fetch vertices with vector data using GSQL `PRINT WITH VECTOR`
210
214
@@ -219,6 +223,11 @@ These operations work with the schema of a specific graph. Each graph has its ow
219
223
-`tigergraph__drop_all_data_sources` - Drop all data sources
220
224
-`tigergraph__preview_sample_data` - Preview sample data from a file
221
225
226
+
### Discovery & Navigation
227
+
-`tigergraph__discover_tools` - Search for tools by description, use case, or keywords
228
+
-`tigergraph__get_workflow` - Get step-by-step workflow templates for common tasks (e.g., `data_loading`, `schema_creation`, `graph_exploration`)
229
+
-`tigergraph__get_tool_info` - Get detailed information about a specific tool (parameters, examples, related tools)
230
+
222
231
## Backward Compatibility
223
232
224
233
All existing pyTigerGraph APIs continue to work as before. MCP support is completely optional and does not affect existing code. The MCP functionality is only available when:
@@ -294,12 +303,91 @@ asyncio.run(call_tool())
294
303
295
304
**Note:** When using `MultiServerMCPClient` or similar MCP clients with stdio transport, the `args` parameter is required. For the `tigergraph-mcp` command (which is a standalone entry point), set `args` to an empty list `[]`. If you need to pass arguments to the command, include them in the list (e.g., `["-v"]` for verbose mode, `["-vv"]` for debug mode).
296
305
306
+
## LLM-Friendly Features
307
+
308
+
The MCP server is designed to help AI agents work effectively with TigerGraph.
309
+
310
+
### Structured Responses
311
+
312
+
Every tool response follows a consistent JSON structure:
313
+
314
+
```json
315
+
{
316
+
"success": true,
317
+
"operation": "get_node",
318
+
"summary": "Found vertex 'p123' of type 'Person'",
319
+
"data": { ... },
320
+
"suggestions": [
321
+
"View connected edges: get_node_edges(...)",
322
+
"Find neighbors: get_neighbors(...)"
323
+
],
324
+
"metadata": { "graph_name": "MyGraph" }
325
+
}
326
+
```
327
+
328
+
Error responses include actionable recovery hints:
329
+
330
+
```json
331
+
{
332
+
"success": false,
333
+
"operation": "get_node",
334
+
"error": "Vertex not found",
335
+
"suggestions": [
336
+
"Verify the vertex_id is correct",
337
+
"Check vertex type with show_graph_details()"
338
+
]
339
+
}
340
+
```
341
+
342
+
### Rich Tool Descriptions
343
+
344
+
Each tool includes detailed descriptions with:
345
+
-**Use cases** — when to call this tool
346
+
-**Common workflows** — step-by-step patterns
347
+
-**Tips** — best practices and gotchas
348
+
-**Warnings** — safety notes for destructive operations
349
+
-**Related tools** — what to call next
350
+
351
+
### Token Optimization
352
+
353
+
Responses are designed for efficient LLM token usage:
354
+
- No echoing of input parameters (the LLM already knows what it sent)
355
+
- Only returns new information (results, counts, boolean answers)
356
+
- Clean text output with no decorative formatting
357
+
358
+
## Tool Discovery Workflow
359
+
360
+
The MCP server includes discovery tools to help AI agents find the right tool for a task:
361
+
362
+
```python
363
+
# 1. Discover tools for a task
364
+
result =await session.call_tool(
365
+
"tigergraph__discover_tools",
366
+
arguments={"query": "how to add data to the graph"}
367
+
)
368
+
# Returns: ranked list of relevant tools with use cases
369
+
370
+
# 2. Get a workflow template
371
+
result =await session.call_tool(
372
+
"tigergraph__get_workflow",
373
+
arguments={"workflow_type": "data_loading"}
374
+
)
375
+
# Returns: step-by-step guide with tool calls
376
+
377
+
# 3. Get detailed tool info
378
+
result =await session.call_tool(
379
+
"tigergraph__get_tool_info",
380
+
arguments={"tool_name": "tigergraph__add_node"}
381
+
)
382
+
# Returns: full documentation, examples, related tools
383
+
```
384
+
297
385
## Notes
298
386
299
387
-**Async APIs**: All MCP tools use pyTigerGraph's async APIs (`AsyncTigerGraphConnection`) for optimal performance
300
388
-**Transport**: The MCP server uses stdio transport by default
301
-
-**Tool Responses**: All tools are async and return `TextContent`responses
302
-
-**Error Handling**: Error handling is built into each tool
389
+
-**Structured Responses**: All tools return structured JSON responses with `success`, `operation`, `summary`, `data`, `suggestions`, and `metadata` fields. Error responses include recovery hints and contextual suggestions
390
+
-**Error Detection**: GSQL operations include error detection for syntax and semantic errors (since `conn.gsql()` does not raise Python exceptions for GSQL failures)
303
391
-**Connection Management**: The connection manager automatically creates async connections from environment variables
304
-
-**Performance**: Using async APIs ensures non-blocking I/O operations, making the MCP server more efficient for concurrent requests
392
+
-**Performance**: Async APIs for non-blocking I/O; `v.outdegree()` for O(1) degree counting; batch operations for multiple vertices/edges
0 commit comments