get_subgraph_detail
Retrieve comprehensive classification details for a specific subgraph, including domain, protocol type, entities, reliability scores, and query instructions.
Instructions
Get full classification detail for a specific subgraph by its subgraph ID or IPFS hash. Returns domain, protocol type, canonical entities, all entity names with field counts, reliability score, signal data, query URL, and step-by-step query instructions.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| subgraph_id | Yes | Subgraph ID or IPFS hash (Qm...) |
Implementation Reference
- src/index.js:269-291 (handler)JavaScript handler function getSubgraphDetail that executes the tool logic - queries SQLite database for a subgraph by ID or IPFS hash, parses JSON fields, and returns full classification details with query URL and instructions.
function getSubgraphDetail({ subgraph_id }) { const row = getDb() .prepare("SELECT * FROM subgraphs WHERE id = ? OR ipfs_hash = ?") .get(subgraph_id, subgraph_id); if (!row) return { error: `Subgraph '${subgraph_id}' not found` }; const result = { ...row }; result.canonical_entities = JSON.parse(result.canonical_entities); result.categories = JSON.parse(result.categories); if (result.all_entities) result.all_entities = JSON.parse(result.all_entities); if (!result.description && result.auto_description) { result.description = result.auto_description; } result.query_url = `https://gateway.thegraph.com/api/[api-key]/subgraphs/id/${result.id}`; result.query_instructions = { step_1: "Get an API key from https://thegraph.com/studio/apikeys/", step_2: `Replace [api-key] in the query_url: https://gateway.thegraph.com/api/YOUR_KEY/subgraphs/id/${result.id}`, step_3: "POST a GraphQL query to that URL. Example: { pools(first: 5, orderBy: totalValueLockedUSD, orderDirection: desc) { id token0 { symbol } token1 { symbol } totalValueLockedUSD } }", note: "Use the all_entities field above to see what entities and fields are available to query.", }; return result; } - python/mcp_server.py:252-267 (handler)Python handler function get_subgraph_detail that executes the tool logic - queries SQLite database for a subgraph by ID or IPFS hash, parses JSON fields, and returns full classification details as JSON.
def get_subgraph_detail(subgraph_id: str) -> str: """Get full classification detail for a specific subgraph by ID or IPFS hash.""" conn = get_db() row = conn.execute( "SELECT * FROM subgraphs WHERE id = ? OR ipfs_hash = ?", (subgraph_id, subgraph_id), ).fetchone() conn.close() if not row: return json.dumps({"error": f"Subgraph '{subgraph_id}' not found"}) d = row_to_dict(row) d["canonical_entities"] = json.loads(d["canonical_entities"]) d["categories"] = json.loads(d["categories"]) return json.dumps(d, indent=2) - src/index.js:348-358 (schema)JavaScript tool schema definition for get_subgraph_detail with name, description, and inputSchema specifying subgraph_id parameter as required.
name: "get_subgraph_detail", description: "Get full classification detail for a specific subgraph by its subgraph ID or IPFS hash. Returns domain, protocol type, canonical entities, all entity names with field counts, reliability score, signal data, query URL, and step-by-step query instructions.", inputSchema: { type: "object", properties: { subgraph_id: { type: "string", description: "Subgraph ID or IPFS hash (Qm...)" }, }, required: ["subgraph_id"], }, }, - python/mcp_server.py:327-336 (schema)Python tool schema definition for get_subgraph_detail with name, description, and inputSchema specifying subgraph_id parameter as required.
"name": "get_subgraph_detail", "description": "Get full classification detail for a specific subgraph by its subgraph ID or IPFS hash. Returns domain, protocol type, canonical entities, reliability score, signal data, and metadata.", "inputSchema": { "type": "object", "properties": { "subgraph_id": {"type": "string", "description": "Subgraph ID or IPFS hash (Qm...)"}, }, "required": ["subgraph_id"], }, }, - src/index.js:370-375 (registration)JavaScript handler registration in HANDLERS object mapping tool name 'get_subgraph_detail' to getSubgraphDetail function.
const HANDLERS = { search_subgraphs: searchSubgraphs, recommend_subgraph: recommendSubgraph, get_subgraph_detail: getSubgraphDetail, list_registry_stats: listRegistryStats, };