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
- Variables
- func Register(srv *server.Server, middlewares ...server.ToolMiddleware)
- type BestPlansInput
- type Config
- type Count
- type ListAPIsInput
- type ProviderInput
- type SearchPlansInput
- type Toolset
- func (t *Toolset) Handle(ctx context.Context, req *protocol.CallToolRequest) (*protocol.CallToolResult, error)
- func (t *Toolset) Handles(name string) bool
- func (t *Toolset) Register(srv *server.Server, middlewares ...server.ToolMiddleware)
- func (t *Toolset) Run(ctx context.Context, name, arguments string) (string, error)
- func (t *Toolset) Tools() []*protocol.Tool
Constants ¶
const ( ListAPIsName = "datacircle_list_apis" BestPlansName = "datacircle_best_plans" SearchPlansName = "datacircle_search_plans" ProviderName = "datacircle_provider" )
const BaseURL = "https://api.datacircle.dev/v1"
BaseURL is the API's address.
const Version = "0.1.0"
Version is this module's version, sent in each call's User-Agent.
Variables ¶
var Names = []string{ListAPIsName, BestPlansName, SearchPlansName, ProviderName}
Names are the four tools' names, in the order Tools gives them.
Functions ¶
Types ¶
type BestPlansInput ¶
BestPlansInput is datacircle_best_plans' input.
type Config ¶
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 ¶
type ListAPIsInput ¶
type ListAPIsInput struct {
Query string `json:"query,omitempty"`
Limit Count `json:"limit,omitempty"`
}
ListAPIsInput is datacircle_list_apis' input.
type ProviderInput ¶
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 ¶
New gives the four tools, calling where cfg says: nil calls BaseURL with http.DefaultClient.
func (*Toolset) Handle ¶
func (t *Toolset) Handle(ctx context.Context, req *protocol.CallToolRequest) (*protocol.CallToolResult, error)
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) 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.