This repository has been archived on 2026-08-16. You can view files and clone it, but cannot push or open issues or pull requests.
ollie-core/pkg/tools/reasoning/server.go

38 lines
957 B
Go

package reasoning
import (
"context"
"encoding/json"
"ollie/pkg/tools"
)
// Decl returns a factory for a reasoning Server.
func Decl() func() tools.Server { return func() tools.Server { return &Server{} } }
// Server implements tools.Server for reasoning_think.
type Server struct{}
// ListTools implements tools.Server.
func (s *Server) ListTools() ([]tools.ToolInfo, error) {
return []tools.ToolInfo{ToolThink}, nil
}
// CallTool implements tools.Server.
func (s *Server) CallTool(_ context.Context, tool string, _ json.RawMessage) (json.RawMessage, error) {
var text string
switch tool {
case ToolThink.Name:
// No-op: the thought is recorded in conversation history by the loop.
default:
text = "error: unknown tool: " + tool
}
result, _ := json.Marshal(map[string]any{
"content": []map[string]string{{"type": "text", "text": text}},
})
return result, nil
}
// Close implements tools.Server (no-op).
func (s *Server) Close() {}