Skip to content

feat(appkit): add FunctionTool, HostedTool types and MCP client#283

Draft
MarioCadenas wants to merge 1 commit intoagent/1-shared-types-adaptersfrom
agent/2a-tool-types-mcp
Draft

feat(appkit): add FunctionTool, HostedTool types and MCP client#283
MarioCadenas wants to merge 1 commit intoagent/1-shared-types-adaptersfrom
agent/2a-tool-types-mcp

Conversation

@MarioCadenas
Copy link
Copy Markdown
Collaborator

@MarioCadenas MarioCadenas commented Apr 16, 2026

Summary

PR 2 of 5 (2a) in the agent plugin stack.

  • FunctionTool: user-defined tools with JSON Schema + execute callback
  • HostedTool: union of Genie, VectorSearch, custom MCP, and external connection configs
  • AppKitMcpClient: minimal JSON-RPC 2.0 client using raw fetch (zero deps)
  • Type guards (isFunctionTool, isHostedTool) and definition converters
  • resolveHostedTools maps HostedTool configs to Databricks MCP endpoint URLs
  • 25 tests covering type guards, definition builders, and URL resolution

PR Stack

  1. Shared types + Adapters — feat(appkit): add shared agent types and LLM adapter implementations #282
  2. Tool types + MCP client (this PR)
  3. Agent plugin core + ToolProvider implementations — feat(appkit): add agent plugin core and ToolProvider implementations #284
  4. PluginContext mediator — feat(appkit): add PluginContext mediator for inter-plugin communication #285
  5. createAgent + apps + docs — feat(appkit): add createAgent wrapper, agent-app, and API docs #286

Test plan

  • 1610 tests pass
  • Typecheck clean
  • Biome lint clean

Add explicit tool type definitions and a lightweight MCP client:

- FunctionTool: user-defined tools with JSON Schema parameters + execute
- HostedTool: Genie, VectorSearch, custom/external MCP endpoint configs
- AppKitMcpClient: zero-dependency JSON-RPC 2.0 client over HTTP fetch
- Type guards (isFunctionTool, isHostedTool) and definition converters
- resolveHostedTools maps HostedTool configs to MCP endpoint URLs
- Test coverage for type guards, definition builders, and URL resolution

Also add ergonomic helpers for defining tools at the app layer:

- tool(): Zod-powered factory for function tools. Generates JSON Schema
  via z.toJSONSchema(), infers execute() arg types from the schema, and
  wraps execution with safeParse so invalid args return an LLM-friendly
  error string instead of throwing.
- mcpServer(name, url): concise factory for custom MCP server tools,
  replacing the verbose { type, custom_mcp_server: { app_name, app_url } }
  wrapper.
- Promote zod from optional peer dep to runtime dep (^4.0.0) so tool()
  and z.toJSONSchema() are always available.

Signed-off-by: MarioCadenas <MarioCadenas@users.noreply.github.com>
@MarioCadenas MarioCadenas force-pushed the agent/2a-tool-types-mcp branch from 629d5c2 to aa77cbb Compare April 17, 2026 11:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant