diff --git a/agent/build_runtime.go b/agent/build_runtime.go index 676845a..0830b40 100644 --- a/agent/build_runtime.go +++ b/agent/build_runtime.go @@ -139,7 +139,8 @@ func BuildRuntime(cfg *AgentConfig, srv toolsrv.Runner, cwd string, env []string } } - // Append compact tool surface listing (name + description). + // Append compact tool surface listing (name + description) plus + // full documentation for loaded tools (schema, args, examples). var toolListing strings.Builder for _, ti := range allToolInfos { if ti.Description != "" && ti.Server == "" { @@ -149,6 +150,21 @@ func BuildRuntime(cfg *AgentConfig, srv toolsrv.Runner, cwd string, env []string if toolListing.Len() > 0 { preamble += "\n# Available Tools\n\n" + toolListing.String() } + // Inject full tool prompts so models that ignore native tool schemas + // still see usage docs, arg definitions, and examples in-context. + var toolDocs strings.Builder + for _, ti := range allToolInfos { + if ti.Prompt != "" && ti.Server == "" { + toolDocs.WriteString(ti.Prompt) + toolDocs.WriteString("\n\n") + if len(ti.InputSchema) > 0 && string(ti.InputSchema) != "{}" { + fmt.Fprintf(&toolDocs, "**Schema**:\n```json\n%s\n```\n\n", ti.InputSchema) + } + } + } + if toolDocs.Len() > 0 { + preamble += "\n# Tool Documentation\n\n" + toolDocs.String() + } // Append 9P discovery instructions for loading additional tools. preamble += "\n## Tool discovery\n\nUse the 9P filesystem to discover and load tools dynamically:\n- **List available tools** — `ollie-9p read session/{id}/agent/{aid}/tools`\n- **Load a tool** — `echo \"toolname\" | ollie-9p write session/{id}/agent/{aid}/tools`\n- **See loaded tools** — `ollie-9p read session/{id}/agent/{aid}/tools.loaded`\n"