Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions DEV.md
Original file line number Diff line number Diff line change
Expand Up @@ -303,7 +303,7 @@ Source: [`crates/konnect-core/src/observability.rs`](crates/konnect-core/src/obs

## Tool Routing (Starter Kit + On-Demand Loading)

The server does NOT expose all 216 tools (222 total with the 6 meta-tools) in `tools/list` by default — that would cost ~23K tokens of context on every listing. Instead:
The server does NOT expose all 217 tools (223 total with the 6 meta-tools) in `tools/list` by default — that would cost ~23K tokens of context on every listing. Instead:

- **Startup**: only `STARTER_KIT` toolsets are pre-loaded (see `router/registry.rs::STARTER_KIT`). Currently: `project`, `config`. Combined with the 6 meta-tools, baseline `tools/list` is 20 tools ≈ 2K tokens.
- **On demand**: the LLM reads `list_toolboxes` → calls `load_toolset(name)` to expose a toolset's tools in subsequent `tools/list` responses. `unload_toolset(name)` prunes them when the task shifts.
Expand Down Expand Up @@ -378,9 +378,9 @@ convention for other `kicad-cli`-calling code.

## Current Stats

- **20 toolsets, 216 tools** + 6 meta-tools (4 routing + 2 observability — see `tool-directory.md`)
- **20 toolsets, 217 tools** + 6 meta-tools (4 routing + 2 observability — see `tool-directory.md`)
- Baseline `tools/list`: 20 tools / ~2K tokens (starter kit + meta-tools)
- Full-catalog `tools/list` (all loaded): 222 tools (216 registered + 6 meta) / ~25K tokens
- Full-catalog `tools/list` (all loaded): 223 tools (217 registered + 6 meta) / ~25K tokens
- **0 IPC stubs** (all protobuf methods implemented)
- **0 unimplemented tools**
- **Specctra DSN/SES are PCB-editor operations**, not `kicad-cli` commands. Konnect
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
Rust binary — that lets Claude and other AI assistants design schematics and PCBs
through the [Model Context Protocol](https://modelcontextprotocol.io) (MCP).

**216 tools across 20 on-demand toolsets.** Schematic capture, PCB layout and
**217 tools across 20 on-demand toolsets.** Schematic capture, PCB layout and
routing, ERC/DRC, design-review audits, JLCPCB part search, reference
circuits, and a full manufacturing export pipeline — with bundled skills and agents
that teach Claude KiCAD conventions out of the box.
Expand Down Expand Up @@ -70,7 +70,7 @@ through its own S-expression engine with atomic writes (write, fsync, rename), U
preservation, and round-trip tests — no third-party schematic library with known
gaps, no text-manipulation workarounds.

**Context economy is a feature.** Exposing all 216 tools to an LLM costs roughly 23K
**Context economy is a feature.** Exposing all 217 tools to an LLM costs roughly 23K
tokens of context on every listing. Konnect's router loads a starter kit (~2K
tokens) and lets the model pull in toolsets on demand — plus built-in observability
(`get_recent_calls`, `server_stats`, JSONL call logs) so the model can diagnose its
Expand Down
2 changes: 1 addition & 1 deletion crates/konnect-core/src/router/registry.rs
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ pub static ALL_TOOLSETS: &[ToolsetMeta] = &[
name: "pcb_board",
description: "Board outline, layers, zones, mounting holes, board text, SVG logo import",
category: "pcb",
tool_count: 11,
tool_count: 12,
},
ToolsetMeta {
name: "pcb_components",
Expand Down
17 changes: 17 additions & 0 deletions crates/konnect-core/src/tools/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -333,6 +333,23 @@ pub fn opt_str<'a>(args: &'a Value, key: &str) -> Option<&'a str> {
args[key].as_str()
}

/// Extract an optional array-of-strings argument: `None` when absent, a
/// structured `InvalidArgument` error when present but not an array of
/// strings. Prefer this over `as_array().unwrap_or_default()`, which reports a
/// malformed argument as an empty list.
pub fn opt_str_list(args: &Value, key: &str) -> Result<Option<Vec<String>>, CallToolResult> {
match &args[key] {
Value::Null => Ok(None),
Value::Array(values) => values
.iter()
.map(|value| value.as_str().map(str::to_string))
.collect::<Option<Vec<_>>>()
.map(Some)
.ok_or_else(|| invalid_arg(key, "every entry must be a string")),
_ => Err(invalid_arg(key, "expected an array of strings")),
}
}

/// Extract a required f64 argument. Returns a structured `InvalidArgument`
/// error result if missing or not a number.
pub fn require_f64(args: &Value, key: &str) -> Result<f64, CallToolResult> {
Expand Down
Loading
Loading