golem-http-params-rust

Maps HTTP request elements to Rust 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-rust
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: golem-http-params-rust
Source: https://github.com/golemcloud/golem/tree/main/golem-skills/skills/rust/golem-http-params-rust
Command: npx skills add https://github.com/golemcloud/golem --skill golem-http-params-rust

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 Rust method parameters, and which types are allowed in each position. This Skill provides the complete mapping rules so endpoints parse requests correctly the first time.

Core Features & Use Cases

  • Request Element Mapping: Covers path variables (including catch-all segments), query parameters, header binding via the headers(...) block, and JSON body mapping for POST/PUT/DELETE endpoints.
  • Type Support Reference: Documents which Rust types work for path/query/header parameters (String, integers, floats, bool, char, unit enums, plus Option and Vec for query/headers) and how return types map to HTTP status codes and bodies.
  • Binary and Text Payloads: Explains UnstructuredBinary and UnstructuredText for raw payloads, including MIME type and language restrictions.
  • Use Case: You are building a Rust agent with an endpoint like #[endpoint(get = "/search?q={query}&limit={max}")] and need to confirm that u64 is a valid query parameter type and that the POST body must always be a JSON object keyed by parameter names.

Quick Start

Ask how to map path variables, query parameters, headers, and a JSON body to the parameters of a Rust agent endpoint in Golem.

Frequently Asked Questions about golem-http-params-rust

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

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

Path variables like {task_name} in the mount or endpoint path map to parameters by name. Mount path variables bind to constructor parameters, while endpoint path variables bind to method parameters, and catch-all {*path} captures the remaining segments.

Which Rust types are supported for query parameters and headers?

Supported types are String, char, bool, u8 through u64, i8 through i64, f32, f64, and unit-only enums. For query parameters and headers only, Option<T> makes a value optional and Vec<T> collects repeated params or comma-separated header values.

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, so send {"decision": "approved"} rather than "approved".

How do Golem Rust endpoint return types map to HTTP responses?

Unit returns 204 No Content, a plain T returns 200 with JSON, Option<T> returns 404 when None, and Result<T, E> returns 500 with the JSON error when Err. UnstructuredBinary and UnstructuredText return raw bodies with appropriate Content-Type headers.

Can I accept raw binary or plain text bodies in a Golem endpoint?

Yes, use UnstructuredBinary for binary payloads and UnstructuredText for text/plain bodies, each as the single body parameter. You can restrict binary payloads with AllowedMimeTypes and text payloads with AllowedLanguages via derive macros.