agentsclimarketplace

Extension http outcalls

Skill aiskillstore/marketplace/skills/caffeinelabs/extension-http-outcalls

HTTP outcalls performed by the backend canister (not in the frontend).From its SKILL.md

Install
npx -y skills add aiskillstore/marketplace --skill extension-http-outcalls

Assembled from the repository path, not quoted from the project. Check it against their README if it does not work.

One thing to look at

  • no licenseNo license file was found in the repository. Code published without one is not open source by default, so using it at work is a question for whoever answers licensing questions where you are.

SKILL.md

2.1 KB, 423 tokens by cl100k_base, as published. Nobody here has run it

HTTP Outcalls

HTTP outcalls extension for Caffeine AI.

Overview

This skill adds the ability to make HTTP GET and POST requests from the backend canister. Useful for integrating with external APIs and services.

Backend

For HTTP outcalls that must be performed in the backend:

There is the prefabricated module mo:caffeineai-http-outcalls/outcall.mo that that cannot be modified. It provides fundamental functionality for making HTTP GET or PUT requests in the backend.

module {
  public type TransformationInput = {
    context : Blob;
    response : IC.HttpRequestResult;
  };
  public type TransformationOutput = IC.HttpRequestResult;
  public type Transform = query TransformationInput -> async TransformationOutput;
  public type Header = {
    name: Text;
    value: Text;
  };

  // Helper function for the transform callback used by the IC on HTTP outcalls.
  public func transform(input : TransformationInput) : TransformationOutput;

  // HTTP GET request with a transform callback function.
  public func httpGetRequest(url : Text, extraHeaders: [Header], transform : Transform) : async Text;

  // HTTP POST request, specifying a transform callback.
  public func httpPostRequest(url : Text, extraHeaders: [Header], body : Text, transform : Transform) : async Text;
};

Usage for GET:

import OutCall "mo:caffeineai-http-outcalls/outcall";

actor {
  public query func transform(input: OutCall.TransformationInput) : async OutCall.TransformationOutput {
    OutCall.transform(input);
  };

  func makeGetOutcall(url: Text) : async Text {
    await OutCall.httpGetRequest(url, [], transform);
  };
};

Hint: JSON parsing is not directly supported in Motoko. Better tunnel JSON to frontend for parsing.

POST usage is analogous.

What ships with it: 1 file

11.7 KB alongside SKILL.md

Keep looking

Skills are one crate of 325,949. Ordering is by how many stacks a row turns up in, so the top of any crate is what has actually been picked rather than what has the most stars.