MCPcopy Index your code
hub / github.com/codehamr/codehamr / schemaToTool

Function schemaToTool

internal/tui/model.go:697–707  ·  view source on GitHub ↗

schemaToTool unwraps a tool schema (the map[string]any shape shared by bash and the file tools) into the typed llm.Tool the chat payload expects.

(s map[string]any)

Source from the content-addressed store, hash-verified

695// buildTools exposes the four local tools every turn: bash, read_file,
696// write_file, edit_file. No loop/control tool; a turn ends when the model
697// stops emitting tool calls (see handleStreamClosed).
698func (m *Model) buildTools() []llm.Tool {
699 return []llm.Tool{
700 schemaToTool(tools.BashSchema()),
701 schemaToTool(tools.ReadFileSchema()),
702 schemaToTool(tools.WriteFileSchema()),
703 schemaToTool(tools.EditFileSchema()),
704 }
705}
706
707// schemaToTool unwraps a tool schema (the map[string]any shape shared by bash
708// and the file tools) into the typed llm.Tool the chat payload expects.
709func schemaToTool(s map[string]any) llm.Tool {
710 fn := s["function"].(map[string]any)

Callers 1

buildToolsMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected