mcp_sparql_get_resource_info
Retrieve all properties and values for a specified resource URI using SPARQL queries on the Ontology MCP server, enabling efficient ontology data extraction and analysis.
Instructions
지정된 URI에 대한 모든 속성과 값을 조회합니다
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| endpoint | No | SPARQL 엔드포인트 URL | |
| repository | No | 조회할 리포지토리 이름 | |
| uri | Yes | 조회할 리소스의 URI |
Input Schema (JSON Schema)
{
"properties": {
"endpoint": {
"description": "SPARQL 엔드포인트 URL",
"type": "string"
},
"repository": {
"description": "조회할 리포지토리 이름",
"type": "string"
},
"uri": {
"description": "조회할 리소스의 URI",
"type": "string"
}
},
"required": [
"uri"
],
"type": "object"
}
Implementation Reference
- src/tools/index.ts:239-270 (handler)The MCP tool handler function for 'mcp_sparql_get_resource_info'. Handles input arguments, optionally creates a new SparqlService instance if endpoint provided, calls getResourceInfo, formats result as JSON, and handles errors.async handler(args: GetResourceInfoArgs): Promise<ToolResponse> { try { if (args.endpoint) { const service = new SparqlService({ endpoint: args.endpoint, defaultRepository: args.repository || '' }); const resourceInfo = await service.getResourceInfo(args.uri, args.repository); return { content: [{ type: 'text', text: JSON.stringify(resourceInfo, null, 2) }] }; } else { const resourceInfo = await sparqlService.getResourceInfo(args.uri, args.repository); return { content: [{ type: 'text', text: JSON.stringify(resourceInfo, null, 2) }] }; } } catch (error) { return { content: [{ type: 'text', text: `리소스 정보 조회 오류: ${error instanceof Error ? error.message : String(error)}` }] }; } }
- src/tools/index.ts:221-237 (schema)Input schema validation for the tool parameters: uri (required), repository (optional), endpoint (optional).inputSchema: { type: 'object', properties: { uri: { type: 'string', description: '조회할 리소스의 URI' }, repository: { type: 'string', description: '조회할 리포지토리 이름' }, endpoint: { type: 'string', description: 'SPARQL 엔드포인트 URL' } }, required: ['uri']
- src/index.ts:26-53 (registration)MCP server capabilities registration declaring 'mcp_sparql_get_resource_info' as an available tool (true).mcp_sparql_execute_query: true, mcp_sparql_update: true, mcp_sparql_list_repositories: true, mcp_sparql_list_graphs: true, mcp_sparql_get_resource_info: true, mcp_ollama_run: true, mcp_ollama_show: true, mcp_ollama_pull: true, mcp_ollama_list: true, mcp_ollama_rm: true, mcp_ollama_chat_completion: true, mcp_ollama_status: true, mcp_http_request: true, mcp_openai_chat: true, mcp_openai_image: true, mcp_openai_tts: true, mcp_openai_transcribe: true, mcp_openai_embedding: true, mcp_gemini_generate_text: true, mcp_gemini_chat_completion: true, mcp_gemini_list_models: true, mcp_gemini_generate_images: false, mcp_gemini_generate_image: false, mcp_gemini_generate_videos: false, mcp_gemini_generate_multimodal_content: false, mcp_imagen_generate: false, mcp_gemini_create_image: false, mcp_gemini_edit_image: false
- Core helper method in SparqlService that constructs and executes a SPARQL SELECT query to retrieve all predicate-object pairs (?p ?o) for the given resource URI./** * 리소스 정보 조회 */ async getResourceInfo(uri: string, repository?: string): Promise<any> { const repo = repository || this.config.defaultRepository; try { const response = await this.executeQuery(` SELECT ?p ?o WHERE { <${uri}> ?p ?o . } `, repo); return response; } catch (error) { throw new Error(`리소스 정보 조회 오류: ${error}`); } }
- src/types/index.ts:101-108 (schema)TypeScript interface defining the input arguments for GetResourceInfoArgs used in the tool handler./** * 리소스 정보 조회 도구 인수 */ export interface GetResourceInfoArgs { uri: string; repository?: string; endpoint?: string; }