mcp_sparql_list_graphs
List all named graphs in a specified repository using SPARQL queries to manage and explore ontology data efficiently on the Ontology MCP server.
Instructions
지정된 리포지토리의 모든 명명된 그래프를 나열합니다
Tool call template
This tool declares no required parameters. Add optional parameters from the input schema as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {},
"name": "mcp_sparql_list_graphs"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| endpoint | No | SPARQL 엔드포인트 URL | |
| repository | No | 그래프를 조회할 리포지토리 이름 |
Implementation Reference
- src/tools/index.ts:185-216 (handler)The main handler function for the 'mcp_sparql_list_graphs' tool. It creates a SparqlService instance if endpoint provided, calls listGraphs method, formats result as JSON and returns as ToolResponse.
async handler(args: ListGraphsArgs): Promise<ToolResponse> { try { if (args.endpoint) { const service = new SparqlService({ endpoint: args.endpoint, defaultRepository: args.repository || '' }); const graphs = await service.listGraphs(args.repository); return { content: [{ type: 'text', text: JSON.stringify(graphs, null, 2) }] }; } else { const graphs = await sparqlService.listGraphs(args.repository); return { content: [{ type: 'text', text: JSON.stringify(graphs, null, 2) }] }; } } catch (error) { return { content: [{ type: 'text', text: `그래프 목록 조회 오류: ${error instanceof Error ? error.message : String(error)}` }] }; } } - src/tools/index.ts:171-184 (schema)Input schema definition for the tool parameters: optional repository and endpoint.
inputSchema: { type: 'object', properties: { repository: { type: 'string', description: '그래프를 조회할 리포지토리 이름' }, endpoint: { type: 'string', description: 'SPARQL 엔드포인트 URL' } }, required: [] }, - SparqlService.listGraphs method that executes a SPARQL query to list distinct named graphs in the repository.
async listGraphs(repository?: string): Promise<any> { const repo = repository || this.config.defaultRepository; try { const response = await this.executeQuery(` SELECT DISTINCT ?graph WHERE { GRAPH ?graph { ?s ?p ?o } } ORDER BY ?graph `, repo); return response; } catch (error) { throw new Error(`그래프 목록 조회 오류: ${error}`); } } - src/index.ts:29-29 (registration)Registration in MCP server capabilities indicating the tool is available.
mcp_sparql_list_graphs: true, - src/types/index.ts:96-99 (schema)TypeScript interface defining the input arguments for the tool.
export interface ListGraphsArgs { repository?: string; endpoint?: string; }