Skip to main content
Glama

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

지정된 리포지토리의 모든 명명된 그래프를 나열합니다

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
endpointNoSPARQL 엔드포인트 URL
repositoryNo그래프를 조회할 리포지토리 이름

Implementation Reference

  • 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)}` }] }; } }
  • 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,
  • TypeScript interface defining the input arguments for the tool.
    export interface ListGraphsArgs { repository?: string; endpoint?: string; }

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/bigdata-coss/agent_mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server