Aulafy
Courses/Claude Code + Local AI/Tool calling with local models

Tool calling with local models

When a local agent fails, sometimes the model isn't "dumb": it simply isn't emitting tool calls in the format your runtime expects. The fix starts with small tests and clear traces.

  • Distinguish reasoning failure, parser failure, and permissions failure.
  • Test tools with a minimal case before using real repos.
  • Choose when to use Ollama, Open WebUI, Hermes, MCP, or vLLM.

Layered diagnosis

  • Model: does it know how to follow JSON/tool format?
  • Runtime: do Ollama, Hermes, Open WebUI, or vLLM expect the same format?
  • Parser: does it extract arguments or stick with free text?
  • Permissions: does the tool exist and can it run?
TerminalCode
Prueba mínima:
Herramienta disponible: get_time({ "timezone": "Europe/Madrid" })

Pregunta:
"Usa la herramienta get_time para decirme la hora en Madrid.
No inventes la hora. Si no puedes llamar la herramienta, dilo."

Resultado esperado:
- llamada estructurada a get_time
- argumentos válidos
- respuesta basada en salida real

Common failures

  • The model describes the tool in text but doesn't invoke it.
  • It generates invalid JSON or with made-up fields.
  • The runtime hides the error and it seems like "nothing happens".
  • A quantization or conversion has degraded tool behavior.
  • The tool executes arbitrary code without human review.
TerminalCode
Checklist:
- Log de prompt completo
- Log de tool schema
- Log de salida del modelo antes del parser
- Log de argumentos parseados
- Log de ejecución real
- Regla de aprobación humana para escritura

Official sources

  • Ollama API
  • Open WebUI: Tools & Functions
  • MCP specification: tools
  • Hermes Agent documentation