Skip to content

v0.8.2

Choose a tag to compare

@RomanEmreis RomanEmreis released this 17 Oct 06:27
· 11 commits to main since this release
920a227

neva 0.8.2 lets a server set the instructions its handshake result carries, and lets the client read them. Found while building ferrus-memory, a neva server.

Compatible with 0.8.1: nothing in the public API was removed or changed, and a server that sets no instructions sends the same results as before. MSRV is unchanged at 1.90.

Server instructions

Instructions are how a server tells the client's model when and how to use it. Claude Code, for one, loads them at session start next to the tool names, even while the tools themselves wait behind tool search. A server whose tools pay off only when the model reaches for them unprompted has nowhere else to say so.

DiscoverResult had an instructions field, and so did InitializeResult under legacy-spec, but nothing filled it. The only way to send one was to replace the server/discover handler with map_handler and re-spell everything neva derives: capabilities, extensions, supported versions, the cache TTL. That copy went stale with every new listChanged, extension or changed default (#173).

let app = App::new().with_options(|opt| opt
    .with_name("ferrus-memory")
    .with_instructions(include_str!("instructions.md")));
  • McpOptions::with_instructions sets them for the server/discover result, and for the initialize result under legacy-spec. Unset, the field stays off the wire.
  • The spec sets no length limit, but clients may cut the text: Claude Code keeps the first 4,096 characters.
  • A server that replaced server/discover only to add this field can drop its map_handler(DISCOVER, ..) and get neva's answer back.

On the client

Client::server_instructions() returns what the connected server sent, or None. It is filled by server/discover, and by initialize in the legacy profile and in the dual-mode fallback. Each handshake replaces it, so a reconnect does not keep the previous server's text.

let mut client = Client::new();
client.connect().await?;

if let Some(instructions) = client.server_instructions() {
    println!("{instructions}");
}

Through svir

svir has one place for a server's instructions, the system prompt, and RemoteTools::client() already reaches them. The RemoteTools docs have a new # Instructions section on how to pass them on:

let tools = RemoteTools::new(client).with_prefix("docs_").load().await?;

let mut system = String::from("You are a research assistant.");
if let Some(instructions) = tools.client().server_instructions() {
    system.push_str("\n\n## From the docs server (its tools start with `docs_`)\n\n");
    system.push_str(instructions);
}
let request = svir::Request::new("qwen3").system(system).tools(&tools);
  • Names. The instructions are free text and name the tools as the server does. After rename or with_prefix they still say search where the model is offered docs_search, and nothing rewrites them.
  • Trust. Forwarding a server's instructions lets it write into the system prompt. For a server you do not control, that is a decision, not a default. Put your own instructions first and mark the server's as its own.

Dependencies

  • jsonschema 0.59, behind the client's Tool::validate. It is not in neva's public API.
  • schemars 1.2.3 and sha2 0.11.1.

Known limits

  • A middleware can answer a request itself, but it cannot change a reply a handler produced. Adding a field, redacting or stamping _meta on the way out still means map_handler. Whether neva needs an outgoing hook is left open from #173.

The full list is in CHANGELOG.md. Diff: 0.8.1...0.8.2.