golem-http-params-moonbit

Maps HTTP path, query, header, and body parameters to MoonBit Golem agent methods.

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

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

When exposing Golem agents over HTTP, developers must correctly map incoming request data—path segments, query strings, headers, and bodies—to agent method parameters. This Skill documents the exact mapping rules, supported types, and response conventions so endpoints behave as expected.

Core Features & Use Cases

  • Request Parameter Mapping: Bind path variables (including catch-all segments), query parameters, and headers to method parameters using #derive.endpoint, #derive.mount, and #derive.endpoint_header.
  • Body Handling: Map JSON request bodies to parameters, and accept raw binary or plain-text payloads via UnstructuredBinary and UnstructuredText with MIME type and language restrictions.
  • Response Mapping: Understand how return types (Unit, Option, Result, UnstructuredBinary, UnstructuredText) translate to HTTP status codes and response bodies.
  • Use Case: You are building a REST API agent in MoonBit that accepts a task ID in the path, a filter query parameter, an authorization header, and a JSON body—this Skill shows exactly how to declare each binding and which types are allowed.

Quick Start

Ask the AI to show how to map path variables, query parameters, headers, and a JSON body to a MoonBit Golem agent endpoint method.

Frequently Asked Questions about golem-http-params-moonbit

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

FAQPage Schema
How do I map HTTP path and query parameters in a MoonBit Golem agent?

Declare path variables with {var_name} in the mount or endpoint path and query parameters with ?key={var} syntax in #derive.endpoint. Parameter names must match the variable names, and values are parsed from the URL string.

How do I bind HTTP headers to MoonBit agent method parameters?

Use #derive.endpoint_header("Header-Name", "param_name") for each header you want to map. Each annotation binds one header to one method parameter, and duplicate header names are not allowed.

Which types are supported for path, query, and header parameters in Golem MoonBit agents?

Supported types are String, Char, Bool, UInt, UInt64, Int, Int64, Double, and unit-variant enums. Query and header parameters additionally support Option[T] and Array[T]; all other types must come from the request body.

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, number, or non-object JSON triggers this error.

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

Yes, use UnstructuredBinary for raw binary payloads and UnstructuredText for text/plain bodies. These parameters cannot be bound to path, query, or header variables, and only one such body parameter is allowed per method.

How do Golem agent return types map to HTTP responses?

Unit returns 204 No Content, plain values return 200 with JSON, Option returns 404 when None, and Result returns 500 on Err. UnstructuredBinary and UnstructuredText return raw bodies with appropriate Content-Type headers.