datacircle

package module
v0.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 24, 2026 License: MIT Imports: 15 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

README

Datacircle tools for go-mcp

Find the best GTM APIs. We benchmark all the GTM APIs and we put the results on our website: https://datacircle.dev

This Go module gives a go-mcp server four tools on Datacircle's open API, https://api.datacircle.dev/v1. You need no key and no account.

Tool What the tool gives Call
datacircle_list_apis Every GTM API on Datacircle, with the API's slug, number of plans, number of providers and best plan GET /apis
datacircle_best_plans One API's plans, sorted by score out of 100, best first. Each plan comes with a rank and a price per 1,000 calls GET /apis/{slug}/best
datacircle_search_plans Plans that match a provider or plan name, on all APIs or on one API. Sort by score, provider or price GET /plans
datacircle_provider The APIs a provider sells, and the provider's rank on each API GET /providers/{slug}

Install

go get github.com/waynehamadi/go-mcp-datacircle

You need go-mcp v0.2.9 or later.

Register the tools on your server

package main

import (
	"log"

	"github.com/ThinkInAIXYZ/go-mcp/protocol"
	"github.com/ThinkInAIXYZ/go-mcp/server"
	"github.com/ThinkInAIXYZ/go-mcp/transport"
	datacircle "github.com/waynehamadi/go-mcp-datacircle"
)

func main() {
	srv, err := server.NewServer(transport.NewStdioServerTransport(),
		server.WithServerInfo(protocol.Implementation{Name: "my-server", Version: "1.0.0"}))
	if err != nil {
		log.Fatal(err)
	}
	datacircle.Register(srv)
	// Register your own tools here too.
	if err := srv.Run(); err != nil {
		log.Fatal(err)
	}
}

The tools work the same on each go-mcp transport: stdio, SSE (transport.NewSSEServerTransport) or Streamable HTTP (transport.NewStreamableHTTPServerTransport). Each tool's annotations mark the tool read-only. Register takes go-mcp's tool middlewares too, like server.RateLimitMiddleware.

Set an HTTPClient in datacircle.Config to add a timeout or a proxy. Then call datacircle.New(cfg).Register(srv). With no HTTPClient, the tools use http.DefaultClient.

tools := datacircle.New(&datacircle.Config{HTTPClient: &http.Client{Timeout: 30 * time.Second}})
tools.Register(srv)

Your server can also register the tools itself. tools.Tools() gives the four tool definitions. tools.Handle runs them.

Call a tool yourself

out, err := datacircle.New(nil).Run(ctx, datacircle.BestPlansName, `{"slug":"email-finder","limit":3}`)

Each tool gives back a JSON object as text. Each plan comes with a rank, provider, plan name, score, price per 1,000 (perThousand, in dollars) and a page on datacircle.dev. The plan's page lists every field. A tool also takes the API's name or the provider's name instead of a slug.

If the API gives no data, for example for an unknown slug, the tool gives an error result (isError). The result holds the API's own words and what to send instead. The client can then call again. A network failure comes back as an error result too. Run returns each error result as an error.

Network

Each tool call makes one HTTPS GET request to https://api.datacircle.dev/v1 and nothing else. The request holds only the tool's own arguments: no key, no config, nothing from your sessions. The API takes up to 60 calls a minute from one IP address. The tool waits once, for a minute at most, when the API asks the tool to wait. The module depends only on go-mcp and golang.org/x/text. The module stores nothing.

MIT license.

Documentation

Overview

Package datacircle gives a go-mcp server four tools on Datacircle's open API: find the best GTM APIs.

The API needs no key: https://api.datacircle.dev/v1 (its spec: https://api.datacircle.dev/v1/openapi.json). More at https://datacircle.dev

Index

Constants

View Source
const (
	ListAPIsName    = "datacircle_list_apis"
	BestPlansName   = "datacircle_best_plans"
	SearchPlansName = "datacircle_search_plans"
	ProviderName    = "datacircle_provider"
)
View Source
const BaseURL = "https://api.datacircle.dev/v1"

BaseURL is the API's address.

View Source
const Version = "0.1.0"

Version is this module's version, sent in each call's User-Agent.

Variables

Names are the four tools' names, in the order Tools gives them.

Functions

func Register

func Register(srv *server.Server, middlewares ...server.ToolMiddleware)

Register registers the four tools on a go-mcp server, calling BaseURL with http.DefaultClient. The middlewares, like server.RateLimitMiddleware, wrap each of them, as RegisterTool's do.

Types

type BestPlansInput

type BestPlansInput struct {
	Slug  string `json:"slug"`
	Limit Count  `json:"limit,omitempty"`
}

BestPlansInput is datacircle_best_plans' input.

type Config

type Config struct {
	BaseURL    string
	HTTPClient *http.Client
}

Config sets where the tools call. Its zero value, or nil, calls BaseURL with http.DefaultClient.

type Count

type Count int

Count is a whole number a model may send as a number, as text ("3") or as null, which is 0: left out.

func (*Count) UnmarshalJSON

func (n *Count) UnmarshalJSON(b []byte) error

type ListAPIsInput

type ListAPIsInput struct {
	Query string `json:"query,omitempty"`
	Limit Count  `json:"limit,omitempty"`
}

ListAPIsInput is datacircle_list_apis' input.

type ProviderInput

type ProviderInput struct {
	Slug  string `json:"slug"`
	Limit Count  `json:"limit,omitempty"`
}

ProviderInput is datacircle_provider's input.

type SearchPlansInput

type SearchPlansInput struct {
	API    string `json:"api,omitempty"`
	Query  string `json:"query,omitempty"`
	Sort   string `json:"sort,omitempty"`
	Limit  Count  `json:"limit,omitempty"`
	Offset Count  `json:"offset,omitempty"`
}

SearchPlansInput is datacircle_search_plans' input.

type Toolset

type Toolset struct {
	// contains filtered or unexported fields
}

Toolset runs the four tools: datacircle_list_apis, datacircle_best_plans, datacircle_search_plans and datacircle_provider. Its methods are safe to call from many goroutines.

func New

func New(cfg *Config) *Toolset

New gives the four tools, calling where cfg says: nil calls BaseURL with http.DefaultClient.

func (*Toolset) Handle

Handle runs a call of one of the four tools, as a server.ToolHandlerFunc. Its result is JSON text. When the API gives no data, like for a slug it doesn't know, or can't be reached, the result is an error result (isError) with the API's words and what to send instead, which the model reads and can call again on. A call whose context ends, like past a timeout middleware's time, gives the context's error, as any handler's error, a JSON-RPC error.

func (*Toolset) Handles

func (t *Toolset) Handles(name string) bool

Handles says whether name is one of the four tools'.

func (*Toolset) Register

func (t *Toolset) Register(srv *server.Server, middlewares ...server.ToolMiddleware)

Register registers the four tools on a go-mcp server, beside its own, before or after its Run.

func (*Toolset) Run

func (t *Toolset) Run(ctx context.Context, name, arguments string) (string, error)

Run calls one tool by its name on its arguments, a JSON object, and gives its result as JSON, with no MCP server. A call the API answers with no data, like for a slug it doesn't know, or one the tool can't make, gives an error whose words tell the model what to send instead.

func (*Toolset) Tools

func (t *Toolset) Tools() []*protocol.Tool

Tools gives the four tools' definitions, read-only by their annotations, each new: Handle runs them.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL