tools: promote reasoning_think to builtin
Zero-context-cost scratchpad tool. The thought is recorded in history but returns empty — no output tokens wasted. Registered in ListTools schema and builtins map.
This commit is contained in:
parent
10bd60980a
commit
6fc2e001ac
|
|
@ -7,12 +7,13 @@ import "ollie/toolsrv"
|
||||||
// Builtins returns the default set of built-in tool handlers.
|
// Builtins returns the default set of built-in tool handlers.
|
||||||
func Builtins() map[string]toolsrv.Handler {
|
func Builtins() map[string]toolsrv.Handler {
|
||||||
return map[string]toolsrv.Handler{
|
return map[string]toolsrv.Handler{
|
||||||
"shell": Shell,
|
"shell": Shell,
|
||||||
"tool_list": ToolList,
|
"reasoning_think": Think,
|
||||||
"tool_load": ToolLoad,
|
"tool_list": ToolList,
|
||||||
"tool_active": ToolActive,
|
"tool_load": ToolLoad,
|
||||||
"skill_list": SkillList,
|
"tool_active": ToolActive,
|
||||||
"skill_load": SkillLoad,
|
"skill_list": SkillList,
|
||||||
"skill_active": SkillActive,
|
"skill_load": SkillLoad,
|
||||||
|
"skill_active": SkillActive,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,25 @@
|
||||||
|
package tools
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
"encoding/json"
|
||||||
|
"fmt"
|
||||||
|
|
||||||
|
"ollie/toolsrv"
|
||||||
|
)
|
||||||
|
|
||||||
|
// Think is a scratchpad for externalizing reasoning. The thought is recorded
|
||||||
|
// in conversation history but not shown to the user. Takes up practically
|
||||||
|
// zero context space — the value is in writing it.
|
||||||
|
func Think(ctx context.Context, srv *toolsrv.Server, args json.RawMessage) (string, error) {
|
||||||
|
var a struct {
|
||||||
|
Thought string `json:"thought"`
|
||||||
|
}
|
||||||
|
if err := json.Unmarshal(args, &a); err != nil {
|
||||||
|
return "", fmt.Errorf("reasoning_think: bad args: %w", err)
|
||||||
|
}
|
||||||
|
if a.Thought == "" {
|
||||||
|
return "", fmt.Errorf("reasoning_think: thought is required")
|
||||||
|
}
|
||||||
|
return "", nil
|
||||||
|
}
|
||||||
|
|
@ -201,6 +201,17 @@ Returns tools with descriptions, one per line.`,
|
||||||
"properties": {}
|
"properties": {}
|
||||||
}`),
|
}`),
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
Name: "reasoning_think",
|
||||||
|
Description: `Scratchpad for externalizing reasoning. Recorded in history but not shown to the user.`,
|
||||||
|
InputSchema: json.RawMessage(`{
|
||||||
|
"type": "object",
|
||||||
|
"required": ["thought"],
|
||||||
|
"properties": {
|
||||||
|
"thought": {"type": "string", "description": "Your reasoning."}
|
||||||
|
}
|
||||||
|
}`),
|
||||||
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
if e.toolRegistry != nil && e.sessionID != "" {
|
if e.toolRegistry != nil && e.sessionID != "" {
|
||||||
|
|
|
||||||
Reference in New Issue