Discussed in https://github.com/spring-projects/spring-ai/discussions/2581

Originally posted by **henningSaulCM** March 27, 2025 We have a bunch of tools implemented as Functions and instantiated as Spring Beans (with a custom annotation), e.g.:
  @AcmeTool
  public BiFunction<SomeAcmeTool.Request, ToolContext, AcmeToolResponse<Record>> someAcmeTool(SomeService someService) {
    return new SomeAcmeTool(someService);
 }
To register the tools, we've implemented a custom ToolCallbackProvider that looks for this custom annotation:
public FunctionCallback[] getToolCallbacks() {
    List<FunctionCallback> tools = new ArrayList<>();
    // create ToolCallback for each AcmeTool
    beanFactory.getBeansWithAnnotation(AcmeTool.class).forEach((beanName, acmeTool) -> {
      try {
        ToolCallback toolCallback = springBeanToolCallbackResolver.resolve(beanName);
        tools.add(toolCallback);
      } catch (Exception e) {
        LOG.error("Failed to create ToolCallback for AcmeTool bean '{}'", beanName, e);
        throw e;
      }

    });
    return tools.toArray(new FunctionCallback[0]);
  }
We're wondering if there's a better way... Can the Spring AI [tool annotation](https://github.com/spring-projects/spring-ai/blob/main/spring-ai-core/src/main/java/org/springframework/ai/tool/annotation/Tool.java) somehow be used instead of our custom annotation for our Function beans?

Comment From: markpollack

I think this is a duplicate.