如果即用mcp又要用tool 就需要手动指定,不然不生效,如果只用tool 就可以使用注解方式,不然只能用编程式。
集成mcp
public interface ConsultantService { //stream流式调用 // @SystemMessage(fromResource = "system.txt") public Flux<String> chat(@MemoryId String memoryId, @UserMessage String message); }增加mcp配置类
@Configuration public class MCPConfig { @Value("${bigmodel.api-key}") private String apiKey; @Bean public McpToolProvider mcpToolProvider() { //和MCP服务通信 HttpMcpTransport transport = new HttpMcpTransport.Builder() .sseUrl("https://open.bigmodel.cn/api/mcp/web_search/sse?Authorization="+apiKey) .logRequests(true) .logResponses(true)