Skip to content

feat(tools): HTTP tool runtime (MVP, closes #20)#54

Merged
leo-aa88 merged 1 commit into
mainfrom
issue/20-http-tool
Apr 11, 2026
Merged

feat(tools): HTTP tool runtime (MVP, closes #20)#54
leo-aa88 merged 1 commit into
mainfrom
issue/20-http-tool

Conversation

@leo-aa88
Copy link
Copy Markdown
Member

Summary

Implements the MVP HTTP tool transport for spec.type: http as described in issue #20 and the design doc (HTTP tools / operation mapping).

What changed

  • New package internal/tools/http (package httptool): Execute runs a logical HTTP call from workflow uses (tool.<name>.<operation> → operation string passed through).
  • Operation → HTTP mapping: first segment get|post|put|delete|patch (case-insensitive) selects the method; remaining dot segments become the path (/-joined). Otherwise GET with the full dotted path.
  • Config: baseUrl + optional static headers; header values support env:VAR via existing models.ResolveAPIKeyFrom.
  • Body: JSON body for POST, PUT, PATCH from the with map (empty object if nil).
  • Retries: Honor spec.retry (maxAttempts, backoff) for transport errors and 5xx; 4xx are client errors and are not retried.
  • Registry: internal/tools dispatches type: http to httptool.Execute (default http.Client).

Tests

  • httptest.Server success path and registry e2e.
  • Env-based header resolution.
  • 404 with maxAttempts > 1: exactly one HTTP request (no retry).
  • 503 then 200: second attempt succeeds.
  • parseOperation smoke for POST path shape.

Verification

  • make fmt
  • make test (with -race)
  • make vet

Closes #20

Made with Cursor

- Add httptool package: map uses operation to method/path, JSON body for
  POST/PUT/PATCH, env: header resolution, retries for 5xx/transport (not 4xx)
- Wire registry dispatch for type http with ToolHTTP + optional ToolRetry
- Tests: httptest success, env headers, 404 single attempt, 503 recovery,
  registry integration

Closes #20

Made-with: Cursor
@leo-aa88 leo-aa88 merged commit ea4fb6f into main Apr 11, 2026
4 checks passed
@leo-aa88 leo-aa88 deleted the issue/20-http-tool branch April 11, 2026 22:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[MVP] HTTP tool runtime (internal/tools/http)

1 participant