API Reference — Java
Artifact io.github.muthuishere:toolnexus (Java 21). See the combined API Reference
for every symbol shown in eight-language synced tabs.
Toolkit
Section titled “Toolkit”Toolkit.create(Toolkit.Options opts)Optionsbuilder:.mcpConfig,.skillsDir,.skills,.skillProvider,.skillsFilter,.skillSampleLimit,.builtins,.agents,.extraTools,.waitFor.- Equivalents:
createToolkit(js) ·create_toolkit(py) ·CreateToolkit(go) ·Toolkit.CreateAsync(c#) ·Toolnexus.create_toolkit(elixir).
Skills
Section titled “Skills”SkillSource.load(String... dirs)— back-compat.SkillSource.loadWith(SkillSource.LoadOptions opts)SkillSource.listSkills(LoadOptions opts) -> SkillInventory—.skills,.skipped(SkillSkip.reason; constantsSkillSkip.MISSING_NAME,MALFORMED,DUPLICATE_NAME,UNREADABLE).new SkillSource.SkillDef(name, description, content[, resources, base])LoadOptionsbuilder:.dirs,.skills,.filter,.sampleLimit.skillProvideris aSupplier<List<SkillDef>>.- Equivalents:
loadSkills/listSkills(js) ·load_skills/list_skills(py) ·LoadSkillsWith/ListSkills(go) ·SkillSource.LoadWith/ListSkills(c#) ·Toolnexus.Skill.load/Toolnexus.Skill.list(elixir).
MCP · Adapters · Client
Section titled “MCP · Adapters · Client”McpSource.load(config)Adapters.toOpenAI(tk)·toAnthropic(tk)·toGemini(tk)Client.create(Client.Options)→client.ask(prompt, tk).
Tools you build — native, HTTP, built-ins
Section titled “Tools you build — native, HTTP, built-ins”NativeTool.of(name, description, schema, fn)— overload takes(args, ToolContext).HttpTool.of(HttpTool.Options)—{ name, description, method, url, headers, query, body, resultMode, timeout };timeoutLongms..builtins(...)toggle → ten built-ins:bash · read · write · edit · grep · glob · webfetch · question · apply_patch · todowrite. (BuiltinTools.create()/.select(cfg).)- Equivalents:
defineTool/httpTool(js) ·define_tool/http_tool(py) ·NativeTool/HTTPTool(go) ·NativeTool.Of/HttpTool.Of(c#) ·Toolnexus.Native.define_tool/Toolnexus.Http.tool(elixir).
Sub-agents & teams
Section titled “Sub-agents & teams”Agents.agent(name, new Agents.AgentSpec().does(...).tools(...).soulFile(...).team(...).budget(...)).Agents.Agent.run(RuntimeOptions, prompt): TaskResult—.status(),.text(),.totalTokens().Agents.Agent.asTool(RuntimeOptions): Tool·Agents.composeSoul(Path): ComposedSoul.- Equivalents:
agents.agent/.run/.asTool/composeSoul(js) ·agent(py) ·agents.New(go) ·new Agent(c#) ·Agents.agent(elixir).
A2A — serve & remote agents
Section titled “A2A — serve & remote agents”tk.serve(addr, new Toolkit.ServeOptions().client(llm).a2a(new A2AServer.A2AConfig()...)).A2A.agent(cardUrl)+Toolkit.Options().agents(List<A2A.Agent>)/tk.addAgent(cardUrl).- Equivalents:
tk.serve/tk.addAgent(js) ·serve/add_agent(py) ·Serve/AddAgent(go) ·ServeAsync/AddAgentAsync(c#) ·Toolkit.serve/Toolkit.add_agent(elixir).
Suspension & the human loop
Section titled “Suspension & the human loop”Options.waitFor(Function<Request, Answer>)(toolkit option).record Request(id, kind, prompt, url, data, expiresAt)·record Answer(id, ok, data, reason).ToolResult.pending(Request)·ToolResult.authRequired(url[, prompt])·ToolResult.pendingOf(result): Request.- Equivalents:
waitFor/pending/authRequired/pendingOf(js) ·wait_for/pending(py) ·WaitFor/Pending(go) ·WithWaitFor/ToolResult.Pending(c#) ·wait_for/ToolResult.pending?(elixir).
Media generation
Section titled “Media generation”Guide: Media generation · recipe: Generate images, video and speech · SPEC §7G.
Media.loadStyle(String path): Media.Style·Media.Style.parse(json)·Media.Style.of(map).Media.create(Style... styles)·Media.create(Style style, Options opts)·Media.create(List<Style> styles, Options opts)— a verb resolves to the first style that declares it.new Media.Options().onProgress(Consumer<Progress>).httpClient(HttpClient)—Progress(verb, jobId, status)after every poll;httpClientis the injectedjava.net.http.HttpClient.- Verbs (blocking), each
MediaResult x(XInput in)andMediaResult x(XInput in, LlmClient.CancelToken cancel):image(ImageInput(prompt, width, height, aspectRatio, seed, providerOptions))·video(VideoInput(prompt, image, seconds, aspectRatio, providerOptions))·speech(SpeechInput(text, voice, providerOptions))·transcribe(TranscribeInput(audio, providerOptions))·cloneVoice(CloneVoiceInput(name, samples, providerOptions))·talking(TalkingInput(image, audio, providerOptions)). Each record has a short constructor with only the required args;nullfields are not sent. generate(String verb, Map<String,Object> args)·generate(verb, args, Map<String,Object> providerOptions, LlmClient.CancelToken cancel)— the raw call.Media.MediaResult(List<File> files, String text, String jobId, String status)·Media.File(type, mimeType, url).media.tools(): List<Tool>(source"media"), orToolkit.Options.media(media).RunResult.files: List<LlmClient.RunFile>—RunFile(type, mimeType, url, data, from, callId), in call order; the same parts are ontoolCalls.get(i).parts.- Errors: the function face throws
Media.MediaException(unchecked; message is the exact §7G string); a media tool never throws (isError). - Equivalents:
createMedia(js) ·create_media(py) ·CreateMedia(go) ·Media.Create(c#) ·Toolnexus.Media.new(elixir) ·toolnexus.media/create-media(clojure) ·create_media(rust).