Skip to content

Commit db77efa

Browse files
committed
chore(appkit): regenerate typedoc and sync lockfile after rebase
Typedoc reference grew when the unified entry started exposing tool authoring primitives (defineTool, AppKitMcpClient, DatabricksAdapter, parseTextToolCalls, ToolEntry, ToolRegistry, etc.) that beta.ts now re-exports. Regenerating brings docs/docs/api/ back in sync so the docs:build CI gate passes. pnpm-lock.yaml gains the get-port@7.2.0 entry that was added to @databricks/appkit on main and merged into v4 during the stack rebase. Signed-off-by: MarioCadenas <MarioCadenas@users.noreply.github.com>
1 parent 4dbe99e commit db77efa

17 files changed

Lines changed: 588 additions & 3 deletions
Lines changed: 154 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,154 @@
1+
# Class: AppKitMcpClient
2+
3+
Lightweight MCP client for Databricks-hosted MCP servers.
4+
5+
Uses raw fetch() with JSON-RPC 2.0 over HTTP — no @modelcontextprotocol/sdk
6+
or LangChain dependency. Supports the Streamable HTTP transport only
7+
(POST with JSON-RPC request, single JSON-RPC response). Implements exactly
8+
four methods: `initialize`, `notifications/initialized`, `tools/list`,
9+
`tools/call`. No prompts/resources/completion/sampling.
10+
11+
All outbound URLs are gated by an McpHostPolicy: unallowlisted hosts
12+
are rejected before the first byte is sent, and workspace credentials are
13+
only forwarded to the same-origin workspace. See `mcp-host-policy.ts`.
14+
15+
Rationale for hand-rolling JSON-RPC instead of `@modelcontextprotocol/sdk`:
16+
see the file-level comment at the top of this module.
17+
18+
## Constructors
19+
20+
### Constructor
21+
22+
```ts
23+
new AppKitMcpClient(
24+
workspaceHost: string,
25+
authenticate: () => Promise<Record<string, string>>,
26+
policy: McpHostPolicy,
27+
options: {
28+
dnsLookup?: DnsLookup;
29+
fetchImpl?: (input: string | URL | Request, init?: RequestInit) => Promise<Response>;
30+
}): AppKitMcpClient;
31+
```
32+
33+
#### Parameters
34+
35+
| Parameter | Type |
36+
| ------ | ------ |
37+
| `workspaceHost` | `string` |
38+
| `authenticate` | () => `Promise`\<`Record`\<`string`, `string`\>\> |
39+
| `policy` | `McpHostPolicy` |
40+
| `options` | \{ `dnsLookup?`: `DnsLookup`; `fetchImpl?`: (`input`: `string` \| `URL` \| `Request`, `init?`: `RequestInit`) => `Promise`\<`Response`\>; \} |
41+
| `options.dnsLookup?` | `DnsLookup` |
42+
| `options.fetchImpl?` | (`input`: `string` \| `URL` \| `Request`, `init?`: `RequestInit`) => `Promise`\<`Response`\> |
43+
44+
#### Returns
45+
46+
`AppKitMcpClient`
47+
48+
## Methods
49+
50+
### callTool()
51+
52+
```ts
53+
callTool(
54+
qualifiedName: string,
55+
args: unknown,
56+
authHeaders?: Record<string, string>,
57+
callerSignal?: AbortSignal): Promise<string>;
58+
```
59+
60+
#### Parameters
61+
62+
| Parameter | Type |
63+
| ------ | ------ |
64+
| `qualifiedName` | `string` |
65+
| `args` | `unknown` |
66+
| `authHeaders?` | `Record`\<`string`, `string`\> |
67+
| `callerSignal?` | `AbortSignal` |
68+
69+
#### Returns
70+
71+
`Promise`\<`string`\>
72+
73+
***
74+
75+
### canForwardWorkspaceAuth()
76+
77+
```ts
78+
canForwardWorkspaceAuth(serverName: string): boolean;
79+
```
80+
81+
Whether the named MCP server may receive workspace-scoped auth headers
82+
(e.g., an OBO bearer token from an end-user request). Callers should gate
83+
auth-forwarding decisions on this to prevent credential exfiltration to
84+
non-workspace hosts.
85+
86+
#### Parameters
87+
88+
| Parameter | Type |
89+
| ------ | ------ |
90+
| `serverName` | `string` |
91+
92+
#### Returns
93+
94+
`boolean`
95+
96+
***
97+
98+
### close()
99+
100+
```ts
101+
close(): Promise<void>;
102+
```
103+
104+
#### Returns
105+
106+
`Promise`\<`void`\>
107+
108+
***
109+
110+
### connect()
111+
112+
```ts
113+
connect(endpoint: McpEndpointConfig): Promise<void>;
114+
```
115+
116+
#### Parameters
117+
118+
| Parameter | Type |
119+
| ------ | ------ |
120+
| `endpoint` | `McpEndpointConfig` |
121+
122+
#### Returns
123+
124+
`Promise`\<`void`\>
125+
126+
***
127+
128+
### connectAll()
129+
130+
```ts
131+
connectAll(endpoints: McpEndpointConfig[]): Promise<void>;
132+
```
133+
134+
#### Parameters
135+
136+
| Parameter | Type |
137+
| ------ | ------ |
138+
| `endpoints` | `McpEndpointConfig`[] |
139+
140+
#### Returns
141+
142+
`Promise`\<`void`\>
143+
144+
***
145+
146+
### getAllToolDefinitions()
147+
148+
```ts
149+
getAllToolDefinitions(): AgentToolDefinition[];
150+
```
151+
152+
#### Returns
153+
154+
[`AgentToolDefinition`](Interface.AgentToolDefinition.md)[]
Lines changed: 152 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,152 @@
1+
# Class: DatabricksAdapter
2+
3+
Adapter that talks directly to Databricks Model Serving `/invocations` endpoint.
4+
5+
No dependency on the Vercel AI SDK or LangChain. Uses raw `fetch()` to POST
6+
OpenAI-compatible payloads and parses the SSE stream itself. Calls
7+
`authenticate()` per-request so tokens are always fresh.
8+
9+
Handles both structured `tool_calls` responses and text-based tool call
10+
fallback parsing for models that output tool calls as text.
11+
12+
## Examples
13+
14+
```ts
15+
import { createApp, createAgent, agents } from "@databricks/appkit";
16+
import { DatabricksAdapter } from "@databricks/appkit/beta";
17+
import { WorkspaceClient } from "@databricks/sdk-experimental";
18+
19+
const adapter = DatabricksAdapter.fromServingEndpoint({
20+
workspaceClient: new WorkspaceClient({}),
21+
endpointName: "my-endpoint",
22+
});
23+
24+
await createApp({
25+
plugins: [
26+
agents({
27+
agents: {
28+
assistant: createAgent({
29+
instructions: "You are a helpful assistant.",
30+
model: adapter,
31+
}),
32+
},
33+
}),
34+
],
35+
});
36+
```
37+
38+
```ts
39+
const adapter = new DatabricksAdapter({
40+
endpointUrl: "https://host/serving-endpoints/my-endpoint/invocations",
41+
authenticate: async () => ({ Authorization: `Bearer ${token}` }),
42+
});
43+
```
44+
45+
## Implements
46+
47+
- [`AgentAdapter`](Interface.AgentAdapter.md)
48+
49+
## Constructors
50+
51+
### Constructor
52+
53+
```ts
54+
new DatabricksAdapter(options: DatabricksAdapterOptions): DatabricksAdapter;
55+
```
56+
57+
#### Parameters
58+
59+
| Parameter | Type |
60+
| ------ | ------ |
61+
| `options` | `DatabricksAdapterOptions` |
62+
63+
#### Returns
64+
65+
`DatabricksAdapter`
66+
67+
## Methods
68+
69+
### run()
70+
71+
```ts
72+
run(input: AgentInput, context: AgentRunContext): AsyncGenerator<AgentEvent, void, unknown>;
73+
```
74+
75+
#### Parameters
76+
77+
| Parameter | Type |
78+
| ------ | ------ |
79+
| `input` | [`AgentInput`](Interface.AgentInput.md) |
80+
| `context` | [`AgentRunContext`](Interface.AgentRunContext.md) |
81+
82+
#### Returns
83+
84+
`AsyncGenerator`\<[`AgentEvent`](TypeAlias.AgentEvent.md), `void`, `unknown`\>
85+
86+
#### Implementation of
87+
88+
[`AgentAdapter`](Interface.AgentAdapter.md).[`run`](Interface.AgentAdapter.md#run)
89+
90+
***
91+
92+
### fromModelServing()
93+
94+
```ts
95+
static fromModelServing(endpointName?: string, options?: ModelServingOptions): Promise<DatabricksAdapter>;
96+
```
97+
98+
Creates a DatabricksAdapter from a Model Serving endpoint name.
99+
Auto-creates a WorkspaceClient internally. Reads the endpoint name
100+
from the argument or the `DATABRICKS_SERVING_ENDPOINT_NAME` env var.
101+
102+
#### Parameters
103+
104+
| Parameter | Type |
105+
| ------ | ------ |
106+
| `endpointName?` | `string` |
107+
| `options?` | `ModelServingOptions` |
108+
109+
#### Returns
110+
111+
`Promise`\<`DatabricksAdapter`\>
112+
113+
#### Example
114+
115+
```ts
116+
// Reads endpoint from DATABRICKS_SERVING_ENDPOINT_NAME env var
117+
const adapter = await DatabricksAdapter.fromModelServing();
118+
119+
// Explicit endpoint
120+
const adapter = await DatabricksAdapter.fromModelServing("my-endpoint");
121+
122+
// With options
123+
const adapter = await DatabricksAdapter.fromModelServing("my-endpoint", {
124+
maxSteps: 5,
125+
maxTokens: 2048,
126+
});
127+
```
128+
129+
***
130+
131+
### fromServingEndpoint()
132+
133+
```ts
134+
static fromServingEndpoint(options: ServingEndpointOptions): Promise<DatabricksAdapter>;
135+
```
136+
137+
Creates a DatabricksAdapter for a Databricks Model Serving endpoint.
138+
139+
Routes through the shared `connectors/serving/stream` helper, which
140+
delegates to the SDK's `apiClient.request({ raw: true })`. That gives the
141+
adapter centralised URL encoding + authentication with the rest of the
142+
serving surface — no bespoke `fetch()` + `authenticate()` plumbing.
143+
144+
#### Parameters
145+
146+
| Parameter | Type |
147+
| ------ | ------ |
148+
| `options` | `ServingEndpointOptions` |
149+
150+
#### Returns
151+
152+
`Promise`\<`DatabricksAdapter`\>
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# Function: defineTool()
2+
3+
```ts
4+
function defineTool<S>(config: ToolEntry<S>): ToolEntry<S>;
5+
```
6+
7+
Defines a single tool entry for a plugin's internal registry.
8+
9+
The generic `S` flows from `schema` through to the `handler` callback so
10+
`args` is fully typed from the Zod schema. Names are assigned by the
11+
registry key, so they are not repeated inside the entry.
12+
13+
## Type Parameters
14+
15+
| Type Parameter |
16+
| ------ |
17+
| `S` *extends* `ZodType`\<`unknown`, `unknown`, `$ZodTypeInternals`\<`unknown`, `unknown`\>\> |
18+
19+
## Parameters
20+
21+
| Parameter | Type |
22+
| ------ | ------ |
23+
| `config` | [`ToolEntry`](Interface.ToolEntry.md)\<`S`\> |
24+
25+
## Returns
26+
27+
[`ToolEntry`](Interface.ToolEntry.md)\<`S`\>
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# Function: executeFromRegistry()
2+
3+
```ts
4+
function executeFromRegistry(
5+
registry: ToolRegistry,
6+
name: string,
7+
args: unknown,
8+
signal?: AbortSignal): Promise<unknown>;
9+
```
10+
11+
Validates tool-call arguments against the entry's schema and invokes its
12+
handler. On validation failure, returns an LLM-friendly error string
13+
(matching the behavior of `tool()`) rather than throwing, so the model
14+
can self-correct on its next turn.
15+
16+
## Parameters
17+
18+
| Parameter | Type |
19+
| ------ | ------ |
20+
| `registry` | [`ToolRegistry`](TypeAlias.ToolRegistry.md) |
21+
| `name` | `string` |
22+
| `args` | `unknown` |
23+
| `signal?` | `AbortSignal` |
24+
25+
## Returns
26+
27+
`Promise`\<`unknown`\>
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# Function: functionToolToDefinition()
2+
3+
```ts
4+
function functionToolToDefinition(tool: FunctionTool): AgentToolDefinition;
5+
```
6+
7+
## Parameters
8+
9+
| Parameter | Type |
10+
| ------ | ------ |
11+
| `tool` | [`FunctionTool`](Interface.FunctionTool.md) |
12+
13+
## Returns
14+
15+
[`AgentToolDefinition`](Interface.AgentToolDefinition.md)

0 commit comments

Comments
 (0)