Recent Memories(resources/read) 호출 error수정
This commit is contained in:
parent
8aa086b79f
commit
ab6bca3e53
16
API명세서.md
16
API명세서.md
|
|
@ -557,19 +557,21 @@ MCP 서버를 초기화하고 서버 정보 및 지원 기능을 반환합니다
|
||||||
"jsonrpc": "2.0",
|
"jsonrpc": "2.0",
|
||||||
"id": "8",
|
"id": "8",
|
||||||
"result": {
|
"result": {
|
||||||
"uri": "memory://recent",
|
"contents": [
|
||||||
"mimeType": "application/json",
|
{
|
||||||
"text": "{\"message\": \"Resource content for memory://recent\"}",
|
"uri": "memory://recent",
|
||||||
"metadata": {
|
"mimeType": "application/json",
|
||||||
"uri": "memory://recent",
|
"text": "{\"message\": \"Resource content for memory://recent\"}"
|
||||||
"timestamp": 1701234567890
|
}
|
||||||
}
|
]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
**응답 DTO**: `McpResourceResponse.ResourceReadResponse`
|
**응답 DTO**: `McpResourceResponse.ResourceReadResponse`
|
||||||
|
|
||||||
|
**참고:** MCP 프로토콜에 따라 `contents` 필드는 배열이며 필수입니다. 각 요소는 `uri`, `mimeType`, `text` (또는 바이너리 리소스의 경우 `blob`)를 포함합니다.
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
### 7. prompts/list
|
### 7. prompts/list
|
||||||
|
|
|
||||||
|
|
@ -39,8 +39,8 @@ AI ↔ Spring Boot(Dewey)
|
||||||
│ ├── api <-- 외부로 노출되는 REST API 계층
|
│ ├── api <-- 외부로 노출되는 REST API 계층
|
||||||
│ │ ├── controller <-- 요청을 받아 Service 호출하는 곳 (Endpoint)
|
│ │ ├── controller <-- 요청을 받아 Service 호출하는 곳 (Endpoint)
|
||||||
│ │ └── dto <-- Controller에서 사용하는 DTO
|
│ │ └── dto <-- Controller에서 사용하는 DTO
|
||||||
│ │ ├── request <-- 요청 DTO
|
│ │ ├── request <-- 요청 DTO
|
||||||
│ │ └── response <-- 응답 DTO
|
│ │ └── response <-- 응답 DTO
|
||||||
│ │
|
│ │
|
||||||
│ ├── config <-- Spring 설정, Bean 등록, CORS, Filter, ModelConfig 등
|
│ ├── config <-- Spring 설정, Bean 등록, CORS, Filter, ModelConfig 등
|
||||||
│ │
|
│ │
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,6 @@ import lombok.Data;
|
||||||
import lombok.NoArgsConstructor;
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* MCP Resource 응답 DTO (View)
|
* MCP Resource 응답 DTO (View)
|
||||||
|
|
@ -37,11 +36,18 @@ public class McpResourceResponse {
|
||||||
@Builder
|
@Builder
|
||||||
@NoArgsConstructor
|
@NoArgsConstructor
|
||||||
@AllArgsConstructor
|
@AllArgsConstructor
|
||||||
public static class ResourceReadResponse {
|
public static class ResourceContent {
|
||||||
private String uri;
|
private String uri;
|
||||||
private String mimeType;
|
private String mimeType;
|
||||||
private String text;
|
private String text;
|
||||||
private Map<String, Object> metadata;
|
}
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@Builder
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
public static class ResourceReadResponse {
|
||||||
|
private List<ResourceContent> contents;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -187,15 +187,18 @@ public class McpServiceImpl implements McpService {
|
||||||
public McpResourceResponse.ResourceReadResponse readResource(String uri) {
|
public McpResourceResponse.ResourceReadResponse readResource(String uri) {
|
||||||
log.info("MCP 리소스 읽기: uri={}", uri);
|
log.info("MCP 리소스 읽기: uri={}", uri);
|
||||||
|
|
||||||
Map<String, Object> metadata = new HashMap<>();
|
// MCP 프로토콜에 따라 contents 배열을 반환해야 함
|
||||||
metadata.put("uri", uri);
|
McpResourceResponse.ResourceContent content = McpResourceResponse.ResourceContent.builder()
|
||||||
metadata.put("timestamp", System.currentTimeMillis());
|
|
||||||
|
|
||||||
return McpResourceResponse.ResourceReadResponse.builder()
|
|
||||||
.uri(uri)
|
.uri(uri)
|
||||||
.mimeType("application/json")
|
.mimeType("application/json")
|
||||||
.text("{\"message\": \"Resource content for " + uri + "\"}")
|
.text("{\"message\": \"Resource content for " + uri + "\"}")
|
||||||
.metadata(metadata)
|
.build();
|
||||||
|
|
||||||
|
List<McpResourceResponse.ResourceContent> contents = new ArrayList<>();
|
||||||
|
contents.add(content);
|
||||||
|
|
||||||
|
return McpResourceResponse.ResourceReadResponse.builder()
|
||||||
|
.contents(contents)
|
||||||
.build();
|
.build();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue