golem-http-params-scala

Maps HTTP request elements to Scala agent parameters in Golem endpoints.

1.5k|212|Updated Nov 24, 2023
One-click install
npx skills add https://github.com/golemcloud/golem --skill golem-http-params-scala
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: golem-http-params-scala
Source: https://github.com/golemcloud/golem/tree/main/golem-skills/skills/scala/golem-http-params-scala
Command: npx skills add https://github.com/golemcloud/golem --skill golem-http-params-scala

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

When exposing Golem agents over HTTP, developers need to know exactly how path variables, query parameters, headers, and request bodies map to Scala constructor and method parameters, and which types are allowed in each position. This Skill removes the guesswork and prevents runtime binding and JSON parsing errors.

Core Features & Use Cases

  • Path and Query Mapping: Explains how {varName} path segments, catch-all {*path} variables, and ?key={var} query parameters bind to method parameters by name.
  • Header and Body Binding: Covers the @header annotation for header mapping and the rule that unmapped POST/PUT/DELETE parameters come from a JSON object body keyed by parameter name.
  • Type Support Tables: Lists supported types for path/query/header values (String, Boolean, Int, Long, Float, Double, enums, plus Option and List for query/header only) and the return-type-to-HTTP-status mapping (Unit → 204, Option → 200/404).
  • Use Case: You are defining a Scala agent endpoint def search(query: String, n: Int) and need to confirm the correct @endpoint path syntax and that Int is parsed from the query string.

Quick Start

Ask how to map a path variable, query parameter, header, or JSON body field to a Scala agent endpoint parameter in Golem.

Frequently Asked Questions about golem-http-params-scala

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I map path variables to Scala agent parameters in Golem?

Path variables like {name} in the mount or endpoint path bind to parameters by matching name. Mount path variables map to the agent constructor's Id class, while endpoint path variables map to method parameters.

How do I map HTTP headers to endpoint parameters in Scala?

Use the @header annotation from golem.runtime.annotations on individual method parameters, for example @header("X-Tenant") tenantId: String. The header value is parsed into the declared parameter type.

What types are supported for path, query, and header parameters?

Supported types are String, Boolean, Int, Long, Float, Double, and enums or sealed traits with unit cases only. Query parameters and headers additionally support Option[T] and List[T] or Array[T] wrappers.

Why does my Golem endpoint fail with REQUEST_JSON_BODY_PARSING_FAILED?

The request body must always be a JSON object with parameter names as keys, even for a single body parameter. Sending a bare string or non-object JSON triggers this error; send {"decision": "approved"} instead of "approved".

Can I use a catch-all path variable in a Golem mount path?

No, catch-all variables like {*filePath} are only allowed in endpoint paths, not mount paths. They must also appear as the last path segment and capture everything after the prefix.

How do Golem endpoint return types map to HTTP responses?

Future[Unit] returns 204 No Content with an empty body, Future[T] returns 200 OK with JSON-serialized T, and Future[Option[T]] returns 200 for Some or 404 Not Found for None.