package org.dromara.ai.mcp.tools;

import org.dromara.ai.mcp.McpTool;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

public class DataTransformTool implements McpTool {
    @Override
    public String name() {
        return "data_transform";
    }

    @Override
    public String description() {
        return "数据格式转换";
    }

    @Override
    public Map<String, Object> schema() {
        Map<String, Object> s = new HashMap<>();
        s.put("type", "object");
        s.put("properties", Map.of("items", Map.of("type", "array")));
        return s;
    }

    @Override
    public Map<String, Object> invoke(Map<String, Object> input) {
        Object items = input.get("items");
        return Map.of("count", items instanceof List ? ((List<?>) items).size() : 0);
    }
}
