server

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Nov 28, 2026 License: MIT Imports: 7 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.

Documentation

Overview

Package server exposes funnel's map-reduce, map, filter, and reduce primitives over the Model Context Protocol (MCP).

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func New

func New(eng *engine.Engine, cfg Config) *mcp.Server

New creates an MCP Server wired to eng and cfg.

Types

type Config

type Config struct {
	Version            string
	DefaultMapModel    string
	DefaultReduceModel string
	MaxItems           int
	MaxTotalBytes      int
	MaxConcurrency     int
	RootDir            string
}

Config provides server-wide defaults and ceilings for MCP tool invocations.

type FilterArgs

type FilterArgs struct {
	InputArgs
	PredicatePrompt string `json:"predicate_prompt" jsonschema:"Yes/no condition to evaluate against every item in parallel"`
	Model           string `json:"model,omitempty" jsonschema:"Model ID for predicate evaluation (defaults to FUNNEL_MAP_MODEL)"`
	Concurrency     int    `json:"concurrency,omitempty" jsonschema:"Max parallel shard requests (default 8)"`
	Retries         int    `json:"retries,omitempty" jsonschema:"Retries per shard on transient errors (default 2)"`
	TimeoutSeconds  int    `json:"timeout_seconds,omitempty" jsonschema:"Per-shard timeout in seconds (default 60)"`
}

FilterArgs configures the funnel_filter tool.

type InputArgs

type InputArgs struct {
	Items         []string `json:"items,omitempty" jsonschema:"Inline strings to process in parallel"`
	Paths         []string `json:"paths,omitempty" jsonschema:"File paths to read out-of-band on the server"`
	Glob          string   `json:"glob,omitempty" jsonschema:"Glob pattern (supports ** and respects .gitignore) to read files out-of-band"`
	ChunksFrom    string   `json:"chunks_from,omitempty" jsonschema:"Single large file path to split into line-based chunks"`
	ChunkLines    int      `json:"chunk_lines,omitempty" jsonschema:"Lines per chunk when using chunks_from (default 200)"`
	MaxItems      int      `json:"max_items,omitempty" jsonschema:"Maximum number of items/files allowed (default 256)"`
	MaxTotalBytes int      `json:"max_total_bytes,omitempty" jsonschema:"Maximum total bytes allowed across all inputs"`
}

InputArgs defines common shard input sources shared by map-based tools.

type MapArgs

type MapArgs struct {
	InputArgs
	MapPrompt      string `json:"map_prompt" jsonschema:"Prompt applied to each shard (supports {{item}}, {{label}}, {{index}})"`
	MapModel       string `json:"map_model,omitempty" jsonschema:"Model ID for map shards (defaults to FUNNEL_MAP_MODEL)"`
	Concurrency    int    `json:"concurrency,omitempty" jsonschema:"Max parallel shard requests (default 8)"`
	Retries        int    `json:"retries,omitempty" jsonschema:"Retries per shard on transient errors (default 2)"`
	TimeoutSeconds int    `json:"timeout_seconds,omitempty" jsonschema:"Per-shard timeout in seconds (default 60)"`
	JSONMode       bool   `json:"json_mode,omitempty" jsonschema:"Request JSON object output from each shard"`
	OnError        string `json:"on_error,omitempty" jsonschema:"Failure policy: best_effort (default) or fail_fast"`
}

MapArgs configures the funnel_map tool.

type MapReduceArgs

type MapReduceArgs struct {
	InputArgs
	MapPrompt       string `json:"map_prompt" jsonschema:"Prompt applied to each shard (supports {{item}}, {{label}}, {{index}})"`
	ReducePrompt    string `json:"reduce_prompt" jsonschema:"Prompt used to synthesize all map shard outputs"`
	MapModel        string `json:"map_model,omitempty" jsonschema:"Model ID for map shards (defaults to FUNNEL_MAP_MODEL)"`
	ReduceModel     string `json:"reduce_model,omitempty" jsonschema:"Model ID for reduce step (defaults to map_model)"`
	Concurrency     int    `json:"concurrency,omitempty" jsonschema:"Max parallel shard requests (default 8)"`
	Retries         int    `json:"retries,omitempty" jsonschema:"Retries per shard on transient errors (default 2)"`
	TimeoutSeconds  int    `json:"timeout_seconds,omitempty" jsonschema:"Per-shard timeout in seconds (default 60)"`
	MaxReduceTokens int    `json:"max_reduce_tokens,omitempty" jsonschema:"Token budget before automatic tree-reduction (default 48000)"`
	OnError         string `json:"on_error,omitempty" jsonschema:"Failure policy: best_effort (default) or fail_fast"`
	IncludeRaw      bool   `json:"include_raw,omitempty" jsonschema:"Include individual shard outputs in the response (default false)"`
}

MapReduceArgs configures the funnel_map_reduce tool.

type ReduceArgs

type ReduceArgs struct {
	Inputs          []string `json:"inputs" jsonschema:"Intermediate results to synthesize"`
	ReducePrompt    string   `json:"reduce_prompt" jsonschema:"Prompt used to synthesize all inputs"`
	Model           string   `json:"model,omitempty" jsonschema:"Model ID for reduction (defaults to FUNNEL_REDUCE_MODEL or FUNNEL_MAP_MODEL)"`
	Concurrency     int      `json:"concurrency,omitempty" jsonschema:"Max parallel tree-reduce requests (default 8)"`
	Retries         int      `json:"retries,omitempty" jsonschema:"Retries on transient errors (default 2)"`
	TimeoutSeconds  int      `json:"timeout_seconds,omitempty" jsonschema:"Per-call timeout in seconds (default 60)"`
	MaxReduceTokens int      `json:"max_reduce_tokens,omitempty" jsonschema:"Token budget before automatic tree-reduction (default 48000)"`
}

ReduceArgs configures the standalone funnel_reduce tool.

Jump to

Keyboard shortcuts

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