agents 0.0.100 → 0.0.101
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/ai-chat-agent.js +1 -1
- package/dist/{chunk-CGWTDCBQ.js → chunk-4CIGD73X.js} +3 -3
- package/dist/{chunk-CGWTDCBQ.js.map → chunk-4CIGD73X.js.map} +1 -1
- package/dist/index.js +1 -1
- package/dist/mcp/client.d.ts +279 -7
- package/dist/mcp/index.js +1 -1
- package/package.json +2 -3
- package/src/index.ts +1 -1
package/dist/ai-chat-agent.js
CHANGED
|
@@ -269,8 +269,8 @@ var Agent = class extends Server {
|
|
|
269
269
|
).then((_results) => {
|
|
270
270
|
this.broadcast(
|
|
271
271
|
JSON.stringify({
|
|
272
|
-
|
|
273
|
-
|
|
272
|
+
mcp: this.getMcpServers(),
|
|
273
|
+
type: "cf_agent_mcp_servers"
|
|
274
274
|
})
|
|
275
275
|
);
|
|
276
276
|
});
|
|
@@ -788,4 +788,4 @@ export {
|
|
|
788
788
|
getAgentByName,
|
|
789
789
|
StreamingResponse
|
|
790
790
|
};
|
|
791
|
-
//# sourceMappingURL=chunk-
|
|
791
|
+
//# sourceMappingURL=chunk-4CIGD73X.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/index.ts"],"sourcesContent":["import { AsyncLocalStorage } from \"node:async_hooks\";\nimport type { Client } from \"@modelcontextprotocol/sdk/client/index.js\";\nimport type { SSEClientTransportOptions } from \"@modelcontextprotocol/sdk/client/sse.js\";\n\nimport type {\n Prompt,\n Resource,\n ServerCapabilities,\n Tool,\n} from \"@modelcontextprotocol/sdk/types.js\";\nimport { parseCronExpression } from \"cron-schedule\";\nimport { nanoid } from \"nanoid\";\nimport {\n type Connection,\n type ConnectionContext,\n getServerByName,\n type PartyServerOptions,\n routePartykitRequest,\n Server,\n type WSMessage,\n} from \"partyserver\";\nimport { camelCaseToKebabCase } from \"./client\";\nimport { MCPClientManager } from \"./mcp/client\";\n// import type { MCPClientConnection } from \"./mcp/client-connection\";\nimport { DurableObjectOAuthClientProvider } from \"./mcp/do-oauth-client-provider\";\n\nexport type { Connection, ConnectionContext, WSMessage } from \"partyserver\";\n\n/**\n * RPC request message from client\n */\nexport type RPCRequest = {\n type: \"rpc\";\n id: string;\n method: string;\n args: unknown[];\n};\n\n/**\n * State update message from client\n */\nexport type StateUpdateMessage = {\n type: \"cf_agent_state\";\n state: unknown;\n};\n\n/**\n * RPC response message to client\n */\nexport type RPCResponse = {\n type: \"rpc\";\n id: string;\n} & (\n | {\n success: true;\n result: unknown;\n done?: false;\n }\n | {\n success: true;\n result: unknown;\n done: true;\n }\n | {\n success: false;\n error: string;\n }\n);\n\n/**\n * Type guard for RPC request messages\n */\nfunction isRPCRequest(msg: unknown): msg is RPCRequest {\n return (\n typeof msg === \"object\" &&\n msg !== null &&\n \"type\" in msg &&\n msg.type === \"rpc\" &&\n \"id\" in msg &&\n typeof msg.id === \"string\" &&\n \"method\" in msg &&\n typeof msg.method === \"string\" &&\n \"args\" in msg &&\n Array.isArray((msg as RPCRequest).args)\n );\n}\n\n/**\n * Type guard for state update messages\n */\nfunction isStateUpdateMessage(msg: unknown): msg is StateUpdateMessage {\n return (\n typeof msg === \"object\" &&\n msg !== null &&\n \"type\" in msg &&\n msg.type === \"cf_agent_state\" &&\n \"state\" in msg\n );\n}\n\n/**\n * Metadata for a callable method\n */\nexport type CallableMetadata = {\n /** Optional description of what the method does */\n description?: string;\n /** Whether the method supports streaming responses */\n streaming?: boolean;\n};\n\nconst callableMetadata = new Map<Function, CallableMetadata>();\n\n/**\n * Decorator that marks a method as callable by clients\n * @param metadata Optional metadata about the callable method\n */\nexport function unstable_callable(metadata: CallableMetadata = {}) {\n return function callableDecorator<This, Args extends unknown[], Return>(\n target: (this: This, ...args: Args) => Return,\n // biome-ignore lint/correctness/noUnusedFunctionParameters: later\n context: ClassMethodDecoratorContext\n ) {\n if (!callableMetadata.has(target)) {\n callableMetadata.set(target, metadata);\n }\n\n return target;\n };\n}\n\n/**\n * Represents a scheduled task within an Agent\n * @template T Type of the payload data\n */\nexport type Schedule<T = string> = {\n /** Unique identifier for the schedule */\n id: string;\n /** Name of the method to be called */\n callback: string;\n /** Data to be passed to the callback */\n payload: T;\n} & (\n | {\n /** Type of schedule for one-time execution at a specific time */\n type: \"scheduled\";\n /** Timestamp when the task should execute */\n time: number;\n }\n | {\n /** Type of schedule for delayed execution */\n type: \"delayed\";\n /** Timestamp when the task should execute */\n time: number;\n /** Number of seconds to delay execution */\n delayInSeconds: number;\n }\n | {\n /** Type of schedule for recurring execution based on cron expression */\n type: \"cron\";\n /** Timestamp for the next execution */\n time: number;\n /** Cron expression defining the schedule */\n cron: string;\n }\n);\n\nfunction getNextCronTime(cron: string) {\n const interval = parseCronExpression(cron);\n return interval.getNextDate();\n}\n\n/**\n * MCP Server state update message from server -> Client\n */\nexport type MCPServerMessage = {\n type: \"cf_agent_mcp_servers\";\n mcp: MCPServersState;\n};\n\nexport type MCPServersState = {\n servers: {\n [id: string]: MCPServer;\n };\n tools: Tool[];\n prompts: Prompt[];\n resources: Resource[];\n};\n\nexport type MCPServer = {\n name: string;\n server_url: string;\n auth_url: string | null;\n // This state is specifically about the temporary process of getting a token (if needed).\n // Scope outside of that can't be relied upon because when the DO sleeps, there's no way\n // to communicate a change to a non-ready state.\n state: \"authenticating\" | \"connecting\" | \"ready\" | \"discovering\" | \"failed\";\n instructions: string | null;\n capabilities: ServerCapabilities | null;\n};\n\n/**\n * MCP Server data stored in DO SQL for resuming MCP Server connections\n */\ntype MCPServerRow = {\n id: string;\n name: string;\n server_url: string;\n client_id: string | null;\n auth_url: string | null;\n callback_url: string;\n server_options: string;\n};\n\nconst STATE_ROW_ID = \"cf_state_row_id\";\nconst STATE_WAS_CHANGED = \"cf_state_was_changed\";\n\nconst DEFAULT_STATE = {} as unknown;\n\nconst agentContext = new AsyncLocalStorage<{\n agent: Agent<unknown>;\n connection: Connection | undefined;\n request: Request | undefined;\n}>();\n\nexport function getCurrentAgent<\n T extends Agent<unknown, unknown> = Agent<unknown, unknown>,\n>(): {\n agent: T | undefined;\n connection: Connection | undefined;\n request: Request<unknown, CfProperties<unknown>> | undefined;\n} {\n const store = agentContext.getStore() as\n | {\n agent: T;\n connection: Connection | undefined;\n request: Request<unknown, CfProperties<unknown>> | undefined;\n }\n | undefined;\n if (!store) {\n return {\n agent: undefined,\n connection: undefined,\n request: undefined,\n };\n }\n return store;\n}\n\n/**\n * Base class for creating Agent implementations\n * @template Env Environment type containing bindings\n * @template State State type to store within the Agent\n */\nexport class Agent<Env, State = unknown> extends Server<Env> {\n private _state = DEFAULT_STATE as State;\n\n private _ParentClass: typeof Agent<Env, State> =\n Object.getPrototypeOf(this).constructor;\n\n mcp: MCPClientManager = new MCPClientManager(this._ParentClass.name, \"0.0.1\");\n\n /**\n * Initial state for the Agent\n * Override to provide default state values\n */\n initialState: State = DEFAULT_STATE as State;\n\n /**\n * Current state of the Agent\n */\n get state(): State {\n if (this._state !== DEFAULT_STATE) {\n // state was previously set, and populated internal state\n return this._state;\n }\n // looks like this is the first time the state is being accessed\n // check if the state was set in a previous life\n const wasChanged = this.sql<{ state: \"true\" | undefined }>`\n SELECT state FROM cf_agents_state WHERE id = ${STATE_WAS_CHANGED}\n `;\n\n // ok, let's pick up the actual state from the db\n const result = this.sql<{ state: State | undefined }>`\n SELECT state FROM cf_agents_state WHERE id = ${STATE_ROW_ID}\n `;\n\n if (\n wasChanged[0]?.state === \"true\" ||\n // we do this check for people who updated their code before we shipped wasChanged\n result[0]?.state\n ) {\n const state = result[0]?.state as string; // could be null?\n\n this._state = JSON.parse(state);\n return this._state;\n }\n\n // ok, this is the first time the state is being accessed\n // and the state was not set in a previous life\n // so we need to set the initial state (if provided)\n if (this.initialState === DEFAULT_STATE) {\n // no initial state provided, so we return undefined\n return undefined as State;\n }\n // initial state provided, so we set the state,\n // update db and return the initial state\n this.setState(this.initialState);\n return this.initialState;\n }\n\n /**\n * Agent configuration options\n */\n static options = {\n /** Whether the Agent should hibernate when inactive */\n hibernate: true, // default to hibernate\n };\n\n /**\n * Execute SQL queries against the Agent's database\n * @template T Type of the returned rows\n * @param strings SQL query template strings\n * @param values Values to be inserted into the query\n * @returns Array of query results\n */\n sql<T = Record<string, string | number | boolean | null>>(\n strings: TemplateStringsArray,\n ...values: (string | number | boolean | null)[]\n ) {\n let query = \"\";\n try {\n // Construct the SQL query with placeholders\n query = strings.reduce(\n (acc, str, i) => acc + str + (i < values.length ? \"?\" : \"\"),\n \"\"\n );\n\n // Execute the SQL query with the provided values\n return [...this.ctx.storage.sql.exec(query, ...values)] as T[];\n } catch (e) {\n console.error(`failed to execute sql query: ${query}`, e);\n throw this.onError(e);\n }\n }\n constructor(ctx: AgentContext, env: Env) {\n super(ctx, env);\n\n this.sql`\n CREATE TABLE IF NOT EXISTS cf_agents_state (\n id TEXT PRIMARY KEY NOT NULL,\n state TEXT\n )\n `;\n\n void this.ctx.blockConcurrencyWhile(async () => {\n return this._tryCatch(async () => {\n // Create alarms table if it doesn't exist\n this.sql`\n CREATE TABLE IF NOT EXISTS cf_agents_schedules (\n id TEXT PRIMARY KEY NOT NULL DEFAULT (randomblob(9)),\n callback TEXT,\n payload TEXT,\n type TEXT NOT NULL CHECK(type IN ('scheduled', 'delayed', 'cron')),\n time INTEGER,\n delayInSeconds INTEGER,\n cron TEXT,\n created_at INTEGER DEFAULT (unixepoch())\n )\n `;\n\n // execute any pending alarms and schedule the next alarm\n await this.alarm();\n });\n });\n\n this.sql`\n CREATE TABLE IF NOT EXISTS cf_agents_mcp_servers (\n id TEXT PRIMARY KEY NOT NULL,\n name TEXT NOT NULL,\n server_url TEXT NOT NULL,\n callback_url TEXT NOT NULL,\n client_id TEXT,\n auth_url TEXT,\n server_options TEXT\n )\n `;\n\n const _onRequest = this.onRequest.bind(this);\n this.onRequest = (request: Request) => {\n return agentContext.run(\n { agent: this, connection: undefined, request },\n async () => {\n if (this.mcp.isCallbackRequest(request)) {\n await this.mcp.handleCallbackRequest(request);\n\n // after the MCP connection handshake, we can send updated mcp state\n this.broadcast(\n JSON.stringify({\n mcp: this.getMcpServers(),\n type: \"cf_agent_mcp_servers\",\n })\n );\n\n // We probably should let the user configure this response/redirect, but this is fine for now.\n return new Response(\"<script>window.close();</script>\", {\n headers: { \"content-type\": \"text/html\" },\n status: 200,\n });\n }\n\n return this._tryCatch(() => _onRequest(request));\n }\n );\n };\n\n const _onMessage = this.onMessage.bind(this);\n this.onMessage = async (connection: Connection, message: WSMessage) => {\n return agentContext.run(\n { agent: this, connection, request: undefined },\n async () => {\n if (typeof message !== \"string\") {\n return this._tryCatch(() => _onMessage(connection, message));\n }\n\n let parsed: unknown;\n try {\n parsed = JSON.parse(message);\n } catch (_e) {\n // silently fail and let the onMessage handler handle it\n return this._tryCatch(() => _onMessage(connection, message));\n }\n\n if (isStateUpdateMessage(parsed)) {\n this._setStateInternal(parsed.state as State, connection);\n return;\n }\n\n if (isRPCRequest(parsed)) {\n try {\n const { id, method, args } = parsed;\n\n // Check if method exists and is callable\n const methodFn = this[method as keyof this];\n if (typeof methodFn !== \"function\") {\n throw new Error(`Method ${method} does not exist`);\n }\n\n if (!this._isCallable(method)) {\n throw new Error(`Method ${method} is not callable`);\n }\n\n const metadata = callableMetadata.get(methodFn as Function);\n\n // For streaming methods, pass a StreamingResponse object\n if (metadata?.streaming) {\n const stream = new StreamingResponse(connection, id);\n await methodFn.apply(this, [stream, ...args]);\n return;\n }\n\n // For regular methods, execute and send response\n const result = await methodFn.apply(this, args);\n const response: RPCResponse = {\n done: true,\n id,\n result,\n success: true,\n type: \"rpc\",\n };\n connection.send(JSON.stringify(response));\n } catch (e) {\n // Send error response\n const response: RPCResponse = {\n error:\n e instanceof Error ? e.message : \"Unknown error occurred\",\n id: parsed.id,\n success: false,\n type: \"rpc\",\n };\n connection.send(JSON.stringify(response));\n console.error(\"RPC error:\", e);\n }\n return;\n }\n\n return this._tryCatch(() => _onMessage(connection, message));\n }\n );\n };\n\n const _onConnect = this.onConnect.bind(this);\n this.onConnect = (connection: Connection, ctx: ConnectionContext) => {\n // TODO: This is a hack to ensure the state is sent after the connection is established\n // must fix this\n return agentContext.run(\n { agent: this, connection, request: ctx.request },\n async () => {\n setTimeout(() => {\n if (this.state) {\n connection.send(\n JSON.stringify({\n state: this.state,\n type: \"cf_agent_state\",\n })\n );\n }\n\n connection.send(\n JSON.stringify({\n mcp: this.getMcpServers(),\n type: \"cf_agent_mcp_servers\",\n })\n );\n\n return this._tryCatch(() => _onConnect(connection, ctx));\n }, 20);\n }\n );\n };\n\n const _onStart = this.onStart.bind(this);\n this.onStart = async () => {\n return agentContext.run(\n { agent: this, connection: undefined, request: undefined },\n async () => {\n const servers = this.sql<MCPServerRow>`\n SELECT id, name, server_url, client_id, auth_url, callback_url, server_options FROM cf_agents_mcp_servers;\n `;\n\n // from DO storage, reconnect to all servers not currently in the oauth flow using our saved auth information\n Promise.allSettled(\n servers.map((server) => {\n return this._connectToMcpServerInternal(\n server.name,\n server.server_url,\n server.callback_url,\n server.server_options\n ? JSON.parse(server.server_options)\n : undefined,\n {\n id: server.id,\n oauthClientId: server.client_id ?? undefined,\n }\n );\n })\n ).then((_results) => {\n this.broadcast(\n JSON.stringify({\n type: \"cf_agent_mcp_servers\",\n mcp: this.getMcpServers(),\n })\n );\n });\n await this._tryCatch(() => _onStart());\n }\n );\n };\n }\n\n private _setStateInternal(\n state: State,\n source: Connection | \"server\" = \"server\"\n ) {\n this._state = state;\n this.sql`\n INSERT OR REPLACE INTO cf_agents_state (id, state)\n VALUES (${STATE_ROW_ID}, ${JSON.stringify(state)})\n `;\n this.sql`\n INSERT OR REPLACE INTO cf_agents_state (id, state)\n VALUES (${STATE_WAS_CHANGED}, ${JSON.stringify(true)})\n `;\n this.broadcast(\n JSON.stringify({\n state: state,\n type: \"cf_agent_state\",\n }),\n source !== \"server\" ? [source.id] : []\n );\n return this._tryCatch(() => {\n const { connection, request } = agentContext.getStore() || {};\n return agentContext.run(\n { agent: this, connection, request },\n async () => {\n return this.onStateUpdate(state, source);\n }\n );\n });\n }\n\n /**\n * Update the Agent's state\n * @param state New state to set\n */\n setState(state: State) {\n this._setStateInternal(state, \"server\");\n }\n\n /**\n * Called when the Agent's state is updated\n * @param state Updated state\n * @param source Source of the state update (\"server\" or a client connection)\n */\n // biome-ignore lint/correctness/noUnusedFunctionParameters: overridden later\n onStateUpdate(state: State | undefined, source: Connection | \"server\") {\n // override this to handle state updates\n }\n\n /**\n * Called when the Agent receives an email\n * @param email Email message to process\n */\n // biome-ignore lint/correctness/noUnusedFunctionParameters: overridden later\n onEmail(email: ForwardableEmailMessage) {\n return agentContext.run(\n { agent: this, connection: undefined, request: undefined },\n async () => {\n console.error(\"onEmail not implemented\");\n }\n );\n }\n\n private async _tryCatch<T>(fn: () => T | Promise<T>) {\n try {\n return await fn();\n } catch (e) {\n throw this.onError(e);\n }\n }\n\n override onError(\n connection: Connection,\n error: unknown\n ): void | Promise<void>;\n override onError(error: unknown): void | Promise<void>;\n override onError(connectionOrError: Connection | unknown, error?: unknown) {\n let theError: unknown;\n if (connectionOrError && error) {\n theError = error;\n // this is a websocket connection error\n console.error(\n \"Error on websocket connection:\",\n (connectionOrError as Connection).id,\n theError\n );\n console.error(\n \"Override onError(connection, error) to handle websocket connection errors\"\n );\n } else {\n theError = connectionOrError;\n // this is a server error\n console.error(\"Error on server:\", theError);\n console.error(\"Override onError(error) to handle server errors\");\n }\n throw theError;\n }\n\n /**\n * Render content (not implemented in base class)\n */\n render() {\n throw new Error(\"Not implemented\");\n }\n\n /**\n * Schedule a task to be executed in the future\n * @template T Type of the payload data\n * @param when When to execute the task (Date, seconds delay, or cron expression)\n * @param callback Name of the method to call\n * @param payload Data to pass to the callback\n * @returns Schedule object representing the scheduled task\n */\n async schedule<T = string>(\n when: Date | string | number,\n callback: keyof this,\n payload?: T\n ): Promise<Schedule<T>> {\n const id = nanoid(9);\n\n if (typeof callback !== \"string\") {\n throw new Error(\"Callback must be a string\");\n }\n\n if (typeof this[callback] !== \"function\") {\n throw new Error(`this.${callback} is not a function`);\n }\n\n if (when instanceof Date) {\n const timestamp = Math.floor(when.getTime() / 1000);\n this.sql`\n INSERT OR REPLACE INTO cf_agents_schedules (id, callback, payload, type, time)\n VALUES (${id}, ${callback}, ${JSON.stringify(\n payload\n )}, 'scheduled', ${timestamp})\n `;\n\n await this._scheduleNextAlarm();\n\n return {\n callback: callback,\n id,\n payload: payload as T,\n time: timestamp,\n type: \"scheduled\",\n };\n }\n if (typeof when === \"number\") {\n const time = new Date(Date.now() + when * 1000);\n const timestamp = Math.floor(time.getTime() / 1000);\n\n this.sql`\n INSERT OR REPLACE INTO cf_agents_schedules (id, callback, payload, type, delayInSeconds, time)\n VALUES (${id}, ${callback}, ${JSON.stringify(\n payload\n )}, 'delayed', ${when}, ${timestamp})\n `;\n\n await this._scheduleNextAlarm();\n\n return {\n callback: callback,\n delayInSeconds: when,\n id,\n payload: payload as T,\n time: timestamp,\n type: \"delayed\",\n };\n }\n if (typeof when === \"string\") {\n const nextExecutionTime = getNextCronTime(when);\n const timestamp = Math.floor(nextExecutionTime.getTime() / 1000);\n\n this.sql`\n INSERT OR REPLACE INTO cf_agents_schedules (id, callback, payload, type, cron, time)\n VALUES (${id}, ${callback}, ${JSON.stringify(\n payload\n )}, 'cron', ${when}, ${timestamp})\n `;\n\n await this._scheduleNextAlarm();\n\n return {\n callback: callback,\n cron: when,\n id,\n payload: payload as T,\n time: timestamp,\n type: \"cron\",\n };\n }\n throw new Error(\"Invalid schedule type\");\n }\n\n /**\n * Get a scheduled task by ID\n * @template T Type of the payload data\n * @param id ID of the scheduled task\n * @returns The Schedule object or undefined if not found\n */\n async getSchedule<T = string>(id: string): Promise<Schedule<T> | undefined> {\n const result = this.sql<Schedule<string>>`\n SELECT * FROM cf_agents_schedules WHERE id = ${id}\n `;\n if (!result) {\n console.error(`schedule ${id} not found`);\n return undefined;\n }\n\n return { ...result[0], payload: JSON.parse(result[0].payload) as T };\n }\n\n /**\n * Get scheduled tasks matching the given criteria\n * @template T Type of the payload data\n * @param criteria Criteria to filter schedules\n * @returns Array of matching Schedule objects\n */\n getSchedules<T = string>(\n criteria: {\n id?: string;\n type?: \"scheduled\" | \"delayed\" | \"cron\";\n timeRange?: { start?: Date; end?: Date };\n } = {}\n ): Schedule<T>[] {\n let query = \"SELECT * FROM cf_agents_schedules WHERE 1=1\";\n const params = [];\n\n if (criteria.id) {\n query += \" AND id = ?\";\n params.push(criteria.id);\n }\n\n if (criteria.type) {\n query += \" AND type = ?\";\n params.push(criteria.type);\n }\n\n if (criteria.timeRange) {\n query += \" AND time >= ? AND time <= ?\";\n const start = criteria.timeRange.start || new Date(0);\n const end = criteria.timeRange.end || new Date(999999999999999);\n params.push(\n Math.floor(start.getTime() / 1000),\n Math.floor(end.getTime() / 1000)\n );\n }\n\n const result = this.ctx.storage.sql\n .exec(query, ...params)\n .toArray()\n .map((row) => ({\n ...row,\n payload: JSON.parse(row.payload as string) as T,\n })) as Schedule<T>[];\n\n return result;\n }\n\n /**\n * Cancel a scheduled task\n * @param id ID of the task to cancel\n * @returns true if the task was cancelled, false otherwise\n */\n async cancelSchedule(id: string): Promise<boolean> {\n this.sql`DELETE FROM cf_agents_schedules WHERE id = ${id}`;\n\n await this._scheduleNextAlarm();\n return true;\n }\n\n private async _scheduleNextAlarm() {\n // Find the next schedule that needs to be executed\n const result = this.sql`\n SELECT time FROM cf_agents_schedules \n WHERE time > ${Math.floor(Date.now() / 1000)}\n ORDER BY time ASC \n LIMIT 1\n `;\n if (!result) return;\n\n if (result.length > 0 && \"time\" in result[0]) {\n const nextTime = (result[0].time as number) * 1000;\n await this.ctx.storage.setAlarm(nextTime);\n }\n }\n\n /**\n * Method called when an alarm fires.\n * Executes any scheduled tasks that are due.\n *\n * @remarks\n * To schedule a task, please use the `this.schedule` method instead.\n * See {@link https://developers.cloudflare.com/agents/api-reference/schedule-tasks/}\n */\n public readonly alarm = async () => {\n const now = Math.floor(Date.now() / 1000);\n\n // Get all schedules that should be executed now\n const result = this.sql<Schedule<string>>`\n SELECT * FROM cf_agents_schedules WHERE time <= ${now}\n `;\n\n for (const row of result || []) {\n const callback = this[row.callback as keyof Agent<Env>];\n if (!callback) {\n console.error(`callback ${row.callback} not found`);\n continue;\n }\n await agentContext.run(\n { agent: this, connection: undefined, request: undefined },\n async () => {\n try {\n await (\n callback as (\n payload: unknown,\n schedule: Schedule<unknown>\n ) => Promise<void>\n ).bind(this)(JSON.parse(row.payload as string), row);\n } catch (e) {\n console.error(`error executing callback \"${row.callback}\"`, e);\n }\n }\n );\n if (row.type === \"cron\") {\n // Update next execution time for cron schedules\n const nextExecutionTime = getNextCronTime(row.cron);\n const nextTimestamp = Math.floor(nextExecutionTime.getTime() / 1000);\n\n this.sql`\n UPDATE cf_agents_schedules SET time = ${nextTimestamp} WHERE id = ${row.id}\n `;\n } else {\n // Delete one-time schedules after execution\n this.sql`\n DELETE FROM cf_agents_schedules WHERE id = ${row.id}\n `;\n }\n }\n\n // Schedule the next alarm\n await this._scheduleNextAlarm();\n };\n\n /**\n * Destroy the Agent, removing all state and scheduled tasks\n */\n async destroy() {\n // drop all tables\n this.sql`DROP TABLE IF EXISTS cf_agents_state`;\n this.sql`DROP TABLE IF EXISTS cf_agents_schedules`;\n this.sql`DROP TABLE IF EXISTS cf_agents_mcp_servers`;\n\n // delete all alarms\n await this.ctx.storage.deleteAlarm();\n await this.ctx.storage.deleteAll();\n this.ctx.abort(\"destroyed\"); // enforce that the agent is evicted\n }\n\n /**\n * Get all methods marked as callable on this Agent\n * @returns A map of method names to their metadata\n */\n private _isCallable(method: string): boolean {\n return callableMetadata.has(this[method as keyof this] as Function);\n }\n\n /**\n * Connect to a new MCP Server\n *\n * @param url MCP Server SSE URL\n * @param callbackHost Base host for the agent, used for the redirect URI.\n * @param agentsPrefix agents routing prefix if not using `agents`\n * @param options MCP client and transport (header) options\n * @returns authUrl\n */\n async addMcpServer(\n serverName: string,\n url: string,\n callbackHost: string,\n agentsPrefix = \"agents\",\n options?: {\n client?: ConstructorParameters<typeof Client>[1];\n transport?: {\n headers: HeadersInit;\n };\n }\n ): Promise<{ id: string; authUrl: string | undefined }> {\n const callbackUrl = `${callbackHost}/${agentsPrefix}/${camelCaseToKebabCase(this._ParentClass.name)}/${this.name}/callback`;\n\n const result = await this._connectToMcpServerInternal(\n serverName,\n url,\n callbackUrl,\n options\n );\n this.sql`\n INSERT\n OR REPLACE INTO cf_agents_mcp_servers (id, name, server_url, client_id, auth_url, callback_url, server_options)\n VALUES (\n ${result.id},\n ${serverName},\n ${url},\n ${result.clientId ?? null},\n ${result.authUrl ?? null},\n ${callbackUrl},\n ${options ? JSON.stringify(options) : null}\n );\n `;\n\n this.broadcast(\n JSON.stringify({\n mcp: this.getMcpServers(),\n type: \"cf_agent_mcp_servers\",\n })\n );\n\n return result;\n }\n\n async _connectToMcpServerInternal(\n _serverName: string,\n url: string,\n callbackUrl: string,\n // it's important that any options here are serializable because we put them into our sqlite DB for reconnection purposes\n options?: {\n client?: ConstructorParameters<typeof Client>[1];\n /**\n * We don't expose the normal set of transport options because:\n * 1) we can't serialize things like the auth provider or a fetch function into the DB for reconnection purposes\n * 2) We probably want these options to be agnostic to the transport type (SSE vs Streamable)\n *\n * This has the limitation that you can't override fetch, but I think headers should handle nearly all cases needed (i.e. non-standard bearer auth).\n */\n transport?: {\n headers?: HeadersInit;\n };\n },\n reconnect?: {\n id: string;\n oauthClientId?: string;\n }\n ): Promise<{\n id: string;\n authUrl: string | undefined;\n clientId: string | undefined;\n }> {\n const authProvider = new DurableObjectOAuthClientProvider(\n this.ctx.storage,\n this.name,\n callbackUrl\n );\n\n if (reconnect) {\n authProvider.serverId = reconnect.id;\n if (reconnect.oauthClientId) {\n authProvider.clientId = reconnect.oauthClientId;\n }\n }\n\n // allows passing through transport headers if necessary\n // this handles some non-standard bearer auth setups (i.e. MCP server behind CF access instead of OAuth)\n let headerTransportOpts: SSEClientTransportOptions = {};\n if (options?.transport?.headers) {\n headerTransportOpts = {\n eventSourceInit: {\n fetch: (url, init) =>\n fetch(url, {\n ...init,\n headers: options?.transport?.headers,\n }),\n },\n requestInit: {\n headers: options?.transport?.headers,\n },\n };\n }\n\n const { id, authUrl, clientId } = await this.mcp.connect(url, {\n client: options?.client,\n reconnect,\n transport: {\n ...headerTransportOpts,\n authProvider,\n },\n });\n\n return {\n authUrl,\n clientId,\n id,\n };\n }\n\n async removeMcpServer(id: string) {\n this.mcp.closeConnection(id);\n this.sql`\n DELETE FROM cf_agents_mcp_servers WHERE id = ${id};\n `;\n this.broadcast(\n JSON.stringify({\n mcp: this.getMcpServers(),\n type: \"cf_agent_mcp_servers\",\n })\n );\n }\n\n getMcpServers(): MCPServersState {\n const mcpState: MCPServersState = {\n prompts: this.mcp.listPrompts(),\n resources: this.mcp.listResources(),\n servers: {},\n tools: this.mcp.listTools(),\n };\n\n const servers = this.sql<MCPServerRow>`\n SELECT id, name, server_url, client_id, auth_url, callback_url, server_options FROM cf_agents_mcp_servers;\n `;\n\n for (const server of servers) {\n const serverConn = this.mcp.mcpConnections[server.id];\n mcpState.servers[server.id] = {\n auth_url: server.auth_url,\n capabilities: serverConn?.serverCapabilities ?? null,\n instructions: serverConn?.instructions ?? null,\n name: server.name,\n server_url: server.server_url,\n // mark as \"authenticating\" because the server isn't automatically connected, so it's pending authenticating\n state: serverConn?.connectionState ?? \"authenticating\",\n };\n }\n\n return mcpState;\n }\n}\n\n/**\n * Namespace for creating Agent instances\n * @template Agentic Type of the Agent class\n */\nexport type AgentNamespace<Agentic extends Agent<unknown>> =\n DurableObjectNamespace<Agentic>;\n\n/**\n * Agent's durable context\n */\nexport type AgentContext = DurableObjectState;\n\n/**\n * Configuration options for Agent routing\n */\nexport type AgentOptions<Env> = PartyServerOptions<Env> & {\n /**\n * Whether to enable CORS for the Agent\n */\n cors?: boolean | HeadersInit | undefined;\n};\n\n/**\n * Route a request to the appropriate Agent\n * @param request Request to route\n * @param env Environment containing Agent bindings\n * @param options Routing options\n * @returns Response from the Agent or undefined if no route matched\n */\nexport async function routeAgentRequest<Env>(\n request: Request,\n env: Env,\n options?: AgentOptions<Env>\n) {\n const corsHeaders =\n options?.cors === true\n ? {\n \"Access-Control-Allow-Credentials\": \"true\",\n \"Access-Control-Allow-Methods\": \"GET, POST, HEAD, OPTIONS\",\n \"Access-Control-Allow-Origin\": \"*\",\n \"Access-Control-Max-Age\": \"86400\",\n }\n : options?.cors;\n\n if (request.method === \"OPTIONS\") {\n if (corsHeaders) {\n return new Response(null, {\n headers: corsHeaders,\n });\n }\n console.warn(\n \"Received an OPTIONS request, but cors was not enabled. Pass `cors: true` or `cors: { ...custom cors headers }` to routeAgentRequest to enable CORS.\"\n );\n }\n\n let response = await routePartykitRequest(\n request,\n env as Record<string, unknown>,\n {\n prefix: \"agents\",\n ...(options as PartyServerOptions<Record<string, unknown>>),\n }\n );\n\n if (\n response &&\n corsHeaders &&\n request.headers.get(\"upgrade\")?.toLowerCase() !== \"websocket\" &&\n request.headers.get(\"Upgrade\")?.toLowerCase() !== \"websocket\"\n ) {\n response = new Response(response.body, {\n headers: {\n ...response.headers,\n ...corsHeaders,\n },\n });\n }\n return response;\n}\n\n/**\n * Route an email to the appropriate Agent\n * @param email Email message to route\n * @param env Environment containing Agent bindings\n * @param options Routing options\n */\nexport async function routeAgentEmail<Env>(\n _email: ForwardableEmailMessage,\n _env: Env,\n _options?: AgentOptions<Env>\n): Promise<void> {}\n\n/**\n * Get or create an Agent by name\n * @template Env Environment type containing bindings\n * @template T Type of the Agent class\n * @param namespace Agent namespace\n * @param name Name of the Agent instance\n * @param options Options for Agent creation\n * @returns Promise resolving to an Agent instance stub\n */\nexport async function getAgentByName<Env, T extends Agent<Env>>(\n namespace: AgentNamespace<T>,\n name: string,\n options?: {\n jurisdiction?: DurableObjectJurisdiction;\n locationHint?: DurableObjectLocationHint;\n }\n) {\n return getServerByName<Env, T>(namespace, name, options);\n}\n\n/**\n * A wrapper for streaming responses in callable methods\n */\nexport class StreamingResponse {\n private _connection: Connection;\n private _id: string;\n private _closed = false;\n\n constructor(connection: Connection, id: string) {\n this._connection = connection;\n this._id = id;\n }\n\n /**\n * Send a chunk of data to the client\n * @param chunk The data to send\n */\n send(chunk: unknown) {\n if (this._closed) {\n throw new Error(\"StreamingResponse is already closed\");\n }\n const response: RPCResponse = {\n done: false,\n id: this._id,\n result: chunk,\n success: true,\n type: \"rpc\",\n };\n this._connection.send(JSON.stringify(response));\n }\n\n /**\n * End the stream and send the final chunk (if any)\n * @param finalChunk Optional final chunk of data to send\n */\n end(finalChunk?: unknown) {\n if (this._closed) {\n throw new Error(\"StreamingResponse is already closed\");\n }\n this._closed = true;\n const response: RPCResponse = {\n done: true,\n id: this._id,\n result: finalChunk,\n success: true,\n type: \"rpc\",\n };\n this._connection.send(JSON.stringify(response));\n }\n}\n"],"mappings":";;;;;;;;;;;AAAA,SAAS,yBAAyB;AAUlC,SAAS,2BAA2B;AACpC,SAAS,cAAc;AACvB;AAAA,EAGE;AAAA,EAEA;AAAA,EACA;AAAA,OAEK;AAoDP,SAAS,aAAa,KAAiC;AACrD,SACE,OAAO,QAAQ,YACf,QAAQ,QACR,UAAU,OACV,IAAI,SAAS,SACb,QAAQ,OACR,OAAO,IAAI,OAAO,YAClB,YAAY,OACZ,OAAO,IAAI,WAAW,YACtB,UAAU,OACV,MAAM,QAAS,IAAmB,IAAI;AAE1C;AAKA,SAAS,qBAAqB,KAAyC;AACrE,SACE,OAAO,QAAQ,YACf,QAAQ,QACR,UAAU,OACV,IAAI,SAAS,oBACb,WAAW;AAEf;AAYA,IAAM,mBAAmB,oBAAI,IAAgC;AAMtD,SAAS,kBAAkB,WAA6B,CAAC,GAAG;AACjE,SAAO,SAAS,kBACd,QAEA,SACA;AACA,QAAI,CAAC,iBAAiB,IAAI,MAAM,GAAG;AACjC,uBAAiB,IAAI,QAAQ,QAAQ;AAAA,IACvC;AAEA,WAAO;AAAA,EACT;AACF;AAsCA,SAAS,gBAAgB,MAAc;AACrC,QAAM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B,MAAM;AAAA,MACN,IAAI,KAAK;AAAA,MACT,QAAQ;AAAA,MACR,SAAS;AAAA,MACT,MAAM;AAAA,IACR;AACA,SAAK,YAAY,KAAK,KAAK,UAAU,QAAQ,CAAC;AAAA,EAChD;AACF;","names":["ctx","url"]}
|
|
1
|
+
{"version":3,"sources":["../src/index.ts"],"sourcesContent":["import { AsyncLocalStorage } from \"node:async_hooks\";\nimport type { Client } from \"@modelcontextprotocol/sdk/client/index.js\";\nimport type { SSEClientTransportOptions } from \"@modelcontextprotocol/sdk/client/sse.js\";\n\nimport type {\n Prompt,\n Resource,\n ServerCapabilities,\n Tool,\n} from \"@modelcontextprotocol/sdk/types.js\";\nimport { parseCronExpression } from \"cron-schedule\";\nimport { nanoid } from \"nanoid\";\nimport {\n type Connection,\n type ConnectionContext,\n getServerByName,\n type PartyServerOptions,\n routePartykitRequest,\n Server,\n type WSMessage,\n} from \"partyserver\";\nimport { camelCaseToKebabCase } from \"./client\";\nimport { MCPClientManager } from \"./mcp/client\";\n// import type { MCPClientConnection } from \"./mcp/client-connection\";\nimport { DurableObjectOAuthClientProvider } from \"./mcp/do-oauth-client-provider\";\n\nexport type { Connection, ConnectionContext, WSMessage } from \"partyserver\";\n\n/**\n * RPC request message from client\n */\nexport type RPCRequest = {\n type: \"rpc\";\n id: string;\n method: string;\n args: unknown[];\n};\n\n/**\n * State update message from client\n */\nexport type StateUpdateMessage = {\n type: \"cf_agent_state\";\n state: unknown;\n};\n\n/**\n * RPC response message to client\n */\nexport type RPCResponse = {\n type: \"rpc\";\n id: string;\n} & (\n | {\n success: true;\n result: unknown;\n done?: false;\n }\n | {\n success: true;\n result: unknown;\n done: true;\n }\n | {\n success: false;\n error: string;\n }\n);\n\n/**\n * Type guard for RPC request messages\n */\nfunction isRPCRequest(msg: unknown): msg is RPCRequest {\n return (\n typeof msg === \"object\" &&\n msg !== null &&\n \"type\" in msg &&\n msg.type === \"rpc\" &&\n \"id\" in msg &&\n typeof msg.id === \"string\" &&\n \"method\" in msg &&\n typeof msg.method === \"string\" &&\n \"args\" in msg &&\n Array.isArray((msg as RPCRequest).args)\n );\n}\n\n/**\n * Type guard for state update messages\n */\nfunction isStateUpdateMessage(msg: unknown): msg is StateUpdateMessage {\n return (\n typeof msg === \"object\" &&\n msg !== null &&\n \"type\" in msg &&\n msg.type === \"cf_agent_state\" &&\n \"state\" in msg\n );\n}\n\n/**\n * Metadata for a callable method\n */\nexport type CallableMetadata = {\n /** Optional description of what the method does */\n description?: string;\n /** Whether the method supports streaming responses */\n streaming?: boolean;\n};\n\nconst callableMetadata = new Map<Function, CallableMetadata>();\n\n/**\n * Decorator that marks a method as callable by clients\n * @param metadata Optional metadata about the callable method\n */\nexport function unstable_callable(metadata: CallableMetadata = {}) {\n return function callableDecorator<This, Args extends unknown[], Return>(\n target: (this: This, ...args: Args) => Return,\n // biome-ignore lint/correctness/noUnusedFunctionParameters: later\n context: ClassMethodDecoratorContext\n ) {\n if (!callableMetadata.has(target)) {\n callableMetadata.set(target, metadata);\n }\n\n return target;\n };\n}\n\n/**\n * Represents a scheduled task within an Agent\n * @template T Type of the payload data\n */\nexport type Schedule<T = string> = {\n /** Unique identifier for the schedule */\n id: string;\n /** Name of the method to be called */\n callback: string;\n /** Data to be passed to the callback */\n payload: T;\n} & (\n | {\n /** Type of schedule for one-time execution at a specific time */\n type: \"scheduled\";\n /** Timestamp when the task should execute */\n time: number;\n }\n | {\n /** Type of schedule for delayed execution */\n type: \"delayed\";\n /** Timestamp when the task should execute */\n time: number;\n /** Number of seconds to delay execution */\n delayInSeconds: number;\n }\n | {\n /** Type of schedule for recurring execution based on cron expression */\n type: \"cron\";\n /** Timestamp for the next execution */\n time: number;\n /** Cron expression defining the schedule */\n cron: string;\n }\n);\n\nfunction getNextCronTime(cron: string) {\n const interval = parseCronExpression(cron);\n return interval.getNextDate();\n}\n\n/**\n * MCP Server state update message from server -> Client\n */\nexport type MCPServerMessage = {\n type: \"cf_agent_mcp_servers\";\n mcp: MCPServersState;\n};\n\nexport type MCPServersState = {\n servers: {\n [id: string]: MCPServer;\n };\n tools: Tool[];\n prompts: Prompt[];\n resources: Resource[];\n};\n\nexport type MCPServer = {\n name: string;\n server_url: string;\n auth_url: string | null;\n // This state is specifically about the temporary process of getting a token (if needed).\n // Scope outside of that can't be relied upon because when the DO sleeps, there's no way\n // to communicate a change to a non-ready state.\n state: \"authenticating\" | \"connecting\" | \"ready\" | \"discovering\" | \"failed\";\n instructions: string | null;\n capabilities: ServerCapabilities | null;\n};\n\n/**\n * MCP Server data stored in DO SQL for resuming MCP Server connections\n */\ntype MCPServerRow = {\n id: string;\n name: string;\n server_url: string;\n client_id: string | null;\n auth_url: string | null;\n callback_url: string;\n server_options: string;\n};\n\nconst STATE_ROW_ID = \"cf_state_row_id\";\nconst STATE_WAS_CHANGED = \"cf_state_was_changed\";\n\nconst DEFAULT_STATE = {} as unknown;\n\nconst agentContext = new AsyncLocalStorage<{\n agent: Agent<unknown>;\n connection: Connection | undefined;\n request: Request | undefined;\n}>();\n\nexport function getCurrentAgent<\n T extends Agent<unknown, unknown> = Agent<unknown, unknown>,\n>(): {\n agent: T | undefined;\n connection: Connection | undefined;\n request: Request<unknown, CfProperties<unknown>> | undefined;\n} {\n const store = agentContext.getStore() as\n | {\n agent: T;\n connection: Connection | undefined;\n request: Request<unknown, CfProperties<unknown>> | undefined;\n }\n | undefined;\n if (!store) {\n return {\n agent: undefined,\n connection: undefined,\n request: undefined,\n };\n }\n return store;\n}\n\n/**\n * Base class for creating Agent implementations\n * @template Env Environment type containing bindings\n * @template State State type to store within the Agent\n */\nexport class Agent<Env, State = unknown> extends Server<Env> {\n private _state = DEFAULT_STATE as State;\n\n private _ParentClass: typeof Agent<Env, State> =\n Object.getPrototypeOf(this).constructor;\n\n mcp: MCPClientManager = new MCPClientManager(this._ParentClass.name, \"0.0.1\");\n\n /**\n * Initial state for the Agent\n * Override to provide default state values\n */\n initialState: State = DEFAULT_STATE as State;\n\n /**\n * Current state of the Agent\n */\n get state(): State {\n if (this._state !== DEFAULT_STATE) {\n // state was previously set, and populated internal state\n return this._state;\n }\n // looks like this is the first time the state is being accessed\n // check if the state was set in a previous life\n const wasChanged = this.sql<{ state: \"true\" | undefined }>`\n SELECT state FROM cf_agents_state WHERE id = ${STATE_WAS_CHANGED}\n `;\n\n // ok, let's pick up the actual state from the db\n const result = this.sql<{ state: State | undefined }>`\n SELECT state FROM cf_agents_state WHERE id = ${STATE_ROW_ID}\n `;\n\n if (\n wasChanged[0]?.state === \"true\" ||\n // we do this check for people who updated their code before we shipped wasChanged\n result[0]?.state\n ) {\n const state = result[0]?.state as string; // could be null?\n\n this._state = JSON.parse(state);\n return this._state;\n }\n\n // ok, this is the first time the state is being accessed\n // and the state was not set in a previous life\n // so we need to set the initial state (if provided)\n if (this.initialState === DEFAULT_STATE) {\n // no initial state provided, so we return undefined\n return undefined as State;\n }\n // initial state provided, so we set the state,\n // update db and return the initial state\n this.setState(this.initialState);\n return this.initialState;\n }\n\n /**\n * Agent configuration options\n */\n static options = {\n /** Whether the Agent should hibernate when inactive */\n hibernate: true, // default to hibernate\n };\n\n /**\n * Execute SQL queries against the Agent's database\n * @template T Type of the returned rows\n * @param strings SQL query template strings\n * @param values Values to be inserted into the query\n * @returns Array of query results\n */\n sql<T = Record<string, string | number | boolean | null>>(\n strings: TemplateStringsArray,\n ...values: (string | number | boolean | null)[]\n ) {\n let query = \"\";\n try {\n // Construct the SQL query with placeholders\n query = strings.reduce(\n (acc, str, i) => acc + str + (i < values.length ? \"?\" : \"\"),\n \"\"\n );\n\n // Execute the SQL query with the provided values\n return [...this.ctx.storage.sql.exec(query, ...values)] as T[];\n } catch (e) {\n console.error(`failed to execute sql query: ${query}`, e);\n throw this.onError(e);\n }\n }\n constructor(ctx: AgentContext, env: Env) {\n super(ctx, env);\n\n this.sql`\n CREATE TABLE IF NOT EXISTS cf_agents_state (\n id TEXT PRIMARY KEY NOT NULL,\n state TEXT\n )\n `;\n\n void this.ctx.blockConcurrencyWhile(async () => {\n return this._tryCatch(async () => {\n // Create alarms table if it doesn't exist\n this.sql`\n CREATE TABLE IF NOT EXISTS cf_agents_schedules (\n id TEXT PRIMARY KEY NOT NULL DEFAULT (randomblob(9)),\n callback TEXT,\n payload TEXT,\n type TEXT NOT NULL CHECK(type IN ('scheduled', 'delayed', 'cron')),\n time INTEGER,\n delayInSeconds INTEGER,\n cron TEXT,\n created_at INTEGER DEFAULT (unixepoch())\n )\n `;\n\n // execute any pending alarms and schedule the next alarm\n await this.alarm();\n });\n });\n\n this.sql`\n CREATE TABLE IF NOT EXISTS cf_agents_mcp_servers (\n id TEXT PRIMARY KEY NOT NULL,\n name TEXT NOT NULL,\n server_url TEXT NOT NULL,\n callback_url TEXT NOT NULL,\n client_id TEXT,\n auth_url TEXT,\n server_options TEXT\n )\n `;\n\n const _onRequest = this.onRequest.bind(this);\n this.onRequest = (request: Request) => {\n return agentContext.run(\n { agent: this, connection: undefined, request },\n async () => {\n if (this.mcp.isCallbackRequest(request)) {\n await this.mcp.handleCallbackRequest(request);\n\n // after the MCP connection handshake, we can send updated mcp state\n this.broadcast(\n JSON.stringify({\n mcp: this.getMcpServers(),\n type: \"cf_agent_mcp_servers\",\n })\n );\n\n // We probably should let the user configure this response/redirect, but this is fine for now.\n return new Response(\"<script>window.close();</script>\", {\n headers: { \"content-type\": \"text/html\" },\n status: 200,\n });\n }\n\n return this._tryCatch(() => _onRequest(request));\n }\n );\n };\n\n const _onMessage = this.onMessage.bind(this);\n this.onMessage = async (connection: Connection, message: WSMessage) => {\n return agentContext.run(\n { agent: this, connection, request: undefined },\n async () => {\n if (typeof message !== \"string\") {\n return this._tryCatch(() => _onMessage(connection, message));\n }\n\n let parsed: unknown;\n try {\n parsed = JSON.parse(message);\n } catch (_e) {\n // silently fail and let the onMessage handler handle it\n return this._tryCatch(() => _onMessage(connection, message));\n }\n\n if (isStateUpdateMessage(parsed)) {\n this._setStateInternal(parsed.state as State, connection);\n return;\n }\n\n if (isRPCRequest(parsed)) {\n try {\n const { id, method, args } = parsed;\n\n // Check if method exists and is callable\n const methodFn = this[method as keyof this];\n if (typeof methodFn !== \"function\") {\n throw new Error(`Method ${method} does not exist`);\n }\n\n if (!this._isCallable(method)) {\n throw new Error(`Method ${method} is not callable`);\n }\n\n const metadata = callableMetadata.get(methodFn as Function);\n\n // For streaming methods, pass a StreamingResponse object\n if (metadata?.streaming) {\n const stream = new StreamingResponse(connection, id);\n await methodFn.apply(this, [stream, ...args]);\n return;\n }\n\n // For regular methods, execute and send response\n const result = await methodFn.apply(this, args);\n const response: RPCResponse = {\n done: true,\n id,\n result,\n success: true,\n type: \"rpc\",\n };\n connection.send(JSON.stringify(response));\n } catch (e) {\n // Send error response\n const response: RPCResponse = {\n error:\n e instanceof Error ? e.message : \"Unknown error occurred\",\n id: parsed.id,\n success: false,\n type: \"rpc\",\n };\n connection.send(JSON.stringify(response));\n console.error(\"RPC error:\", e);\n }\n return;\n }\n\n return this._tryCatch(() => _onMessage(connection, message));\n }\n );\n };\n\n const _onConnect = this.onConnect.bind(this);\n this.onConnect = (connection: Connection, ctx: ConnectionContext) => {\n // TODO: This is a hack to ensure the state is sent after the connection is established\n // must fix this\n return agentContext.run(\n { agent: this, connection, request: ctx.request },\n async () => {\n setTimeout(() => {\n if (this.state) {\n connection.send(\n JSON.stringify({\n state: this.state,\n type: \"cf_agent_state\",\n })\n );\n }\n\n connection.send(\n JSON.stringify({\n mcp: this.getMcpServers(),\n type: \"cf_agent_mcp_servers\",\n })\n );\n\n return this._tryCatch(() => _onConnect(connection, ctx));\n }, 20);\n }\n );\n };\n\n const _onStart = this.onStart.bind(this);\n this.onStart = async () => {\n return agentContext.run(\n { agent: this, connection: undefined, request: undefined },\n async () => {\n const servers = this.sql<MCPServerRow>`\n SELECT id, name, server_url, client_id, auth_url, callback_url, server_options FROM cf_agents_mcp_servers;\n `;\n\n // from DO storage, reconnect to all servers not currently in the oauth flow using our saved auth information\n Promise.allSettled(\n servers.map((server) => {\n return this._connectToMcpServerInternal(\n server.name,\n server.server_url,\n server.callback_url,\n server.server_options\n ? JSON.parse(server.server_options)\n : undefined,\n {\n id: server.id,\n oauthClientId: server.client_id ?? undefined,\n }\n );\n })\n ).then((_results) => {\n this.broadcast(\n JSON.stringify({\n mcp: this.getMcpServers(),\n type: \"cf_agent_mcp_servers\",\n })\n );\n });\n await this._tryCatch(() => _onStart());\n }\n );\n };\n }\n\n private _setStateInternal(\n state: State,\n source: Connection | \"server\" = \"server\"\n ) {\n this._state = state;\n this.sql`\n INSERT OR REPLACE INTO cf_agents_state (id, state)\n VALUES (${STATE_ROW_ID}, ${JSON.stringify(state)})\n `;\n this.sql`\n INSERT OR REPLACE INTO cf_agents_state (id, state)\n VALUES (${STATE_WAS_CHANGED}, ${JSON.stringify(true)})\n `;\n this.broadcast(\n JSON.stringify({\n state: state,\n type: \"cf_agent_state\",\n }),\n source !== \"server\" ? [source.id] : []\n );\n return this._tryCatch(() => {\n const { connection, request } = agentContext.getStore() || {};\n return agentContext.run(\n { agent: this, connection, request },\n async () => {\n return this.onStateUpdate(state, source);\n }\n );\n });\n }\n\n /**\n * Update the Agent's state\n * @param state New state to set\n */\n setState(state: State) {\n this._setStateInternal(state, \"server\");\n }\n\n /**\n * Called when the Agent's state is updated\n * @param state Updated state\n * @param source Source of the state update (\"server\" or a client connection)\n */\n // biome-ignore lint/correctness/noUnusedFunctionParameters: overridden later\n onStateUpdate(state: State | undefined, source: Connection | \"server\") {\n // override this to handle state updates\n }\n\n /**\n * Called when the Agent receives an email\n * @param email Email message to process\n */\n // biome-ignore lint/correctness/noUnusedFunctionParameters: overridden later\n onEmail(email: ForwardableEmailMessage) {\n return agentContext.run(\n { agent: this, connection: undefined, request: undefined },\n async () => {\n console.error(\"onEmail not implemented\");\n }\n );\n }\n\n private async _tryCatch<T>(fn: () => T | Promise<T>) {\n try {\n return await fn();\n } catch (e) {\n throw this.onError(e);\n }\n }\n\n override onError(\n connection: Connection,\n error: unknown\n ): void | Promise<void>;\n override onError(error: unknown): void | Promise<void>;\n override onError(connectionOrError: Connection | unknown, error?: unknown) {\n let theError: unknown;\n if (connectionOrError && error) {\n theError = error;\n // this is a websocket connection error\n console.error(\n \"Error on websocket connection:\",\n (connectionOrError as Connection).id,\n theError\n );\n console.error(\n \"Override onError(connection, error) to handle websocket connection errors\"\n );\n } else {\n theError = connectionOrError;\n // this is a server error\n console.error(\"Error on server:\", theError);\n console.error(\"Override onError(error) to handle server errors\");\n }\n throw theError;\n }\n\n /**\n * Render content (not implemented in base class)\n */\n render() {\n throw new Error(\"Not implemented\");\n }\n\n /**\n * Schedule a task to be executed in the future\n * @template T Type of the payload data\n * @param when When to execute the task (Date, seconds delay, or cron expression)\n * @param callback Name of the method to call\n * @param payload Data to pass to the callback\n * @returns Schedule object representing the scheduled task\n */\n async schedule<T = string>(\n when: Date | string | number,\n callback: keyof this,\n payload?: T\n ): Promise<Schedule<T>> {\n const id = nanoid(9);\n\n if (typeof callback !== \"string\") {\n throw new Error(\"Callback must be a string\");\n }\n\n if (typeof this[callback] !== \"function\") {\n throw new Error(`this.${callback} is not a function`);\n }\n\n if (when instanceof Date) {\n const timestamp = Math.floor(when.getTime() / 1000);\n this.sql`\n INSERT OR REPLACE INTO cf_agents_schedules (id, callback, payload, type, time)\n VALUES (${id}, ${callback}, ${JSON.stringify(\n payload\n )}, 'scheduled', ${timestamp})\n `;\n\n await this._scheduleNextAlarm();\n\n return {\n callback: callback,\n id,\n payload: payload as T,\n time: timestamp,\n type: \"scheduled\",\n };\n }\n if (typeof when === \"number\") {\n const time = new Date(Date.now() + when * 1000);\n const timestamp = Math.floor(time.getTime() / 1000);\n\n this.sql`\n INSERT OR REPLACE INTO cf_agents_schedules (id, callback, payload, type, delayInSeconds, time)\n VALUES (${id}, ${callback}, ${JSON.stringify(\n payload\n )}, 'delayed', ${when}, ${timestamp})\n `;\n\n await this._scheduleNextAlarm();\n\n return {\n callback: callback,\n delayInSeconds: when,\n id,\n payload: payload as T,\n time: timestamp,\n type: \"delayed\",\n };\n }\n if (typeof when === \"string\") {\n const nextExecutionTime = getNextCronTime(when);\n const timestamp = Math.floor(nextExecutionTime.getTime() / 1000);\n\n this.sql`\n INSERT OR REPLACE INTO cf_agents_schedules (id, callback, payload, type, cron, time)\n VALUES (${id}, ${callback}, ${JSON.stringify(\n payload\n )}, 'cron', ${when}, ${timestamp})\n `;\n\n await this._scheduleNextAlarm();\n\n return {\n callback: callback,\n cron: when,\n id,\n payload: payload as T,\n time: timestamp,\n type: \"cron\",\n };\n }\n throw new Error(\"Invalid schedule type\");\n }\n\n /**\n * Get a scheduled task by ID\n * @template T Type of the payload data\n * @param id ID of the scheduled task\n * @returns The Schedule object or undefined if not found\n */\n async getSchedule<T = string>(id: string): Promise<Schedule<T> | undefined> {\n const result = this.sql<Schedule<string>>`\n SELECT * FROM cf_agents_schedules WHERE id = ${id}\n `;\n if (!result) {\n console.error(`schedule ${id} not found`);\n return undefined;\n }\n\n return { ...result[0], payload: JSON.parse(result[0].payload) as T };\n }\n\n /**\n * Get scheduled tasks matching the given criteria\n * @template T Type of the payload data\n * @param criteria Criteria to filter schedules\n * @returns Array of matching Schedule objects\n */\n getSchedules<T = string>(\n criteria: {\n id?: string;\n type?: \"scheduled\" | \"delayed\" | \"cron\";\n timeRange?: { start?: Date; end?: Date };\n } = {}\n ): Schedule<T>[] {\n let query = \"SELECT * FROM cf_agents_schedules WHERE 1=1\";\n const params = [];\n\n if (criteria.id) {\n query += \" AND id = ?\";\n params.push(criteria.id);\n }\n\n if (criteria.type) {\n query += \" AND type = ?\";\n params.push(criteria.type);\n }\n\n if (criteria.timeRange) {\n query += \" AND time >= ? AND time <= ?\";\n const start = criteria.timeRange.start || new Date(0);\n const end = criteria.timeRange.end || new Date(999999999999999);\n params.push(\n Math.floor(start.getTime() / 1000),\n Math.floor(end.getTime() / 1000)\n );\n }\n\n const result = this.ctx.storage.sql\n .exec(query, ...params)\n .toArray()\n .map((row) => ({\n ...row,\n payload: JSON.parse(row.payload as string) as T,\n })) as Schedule<T>[];\n\n return result;\n }\n\n /**\n * Cancel a scheduled task\n * @param id ID of the task to cancel\n * @returns true if the task was cancelled, false otherwise\n */\n async cancelSchedule(id: string): Promise<boolean> {\n this.sql`DELETE FROM cf_agents_schedules WHERE id = ${id}`;\n\n await this._scheduleNextAlarm();\n return true;\n }\n\n private async _scheduleNextAlarm() {\n // Find the next schedule that needs to be executed\n const result = this.sql`\n SELECT time FROM cf_agents_schedules \n WHERE time > ${Math.floor(Date.now() / 1000)}\n ORDER BY time ASC \n LIMIT 1\n `;\n if (!result) return;\n\n if (result.length > 0 && \"time\" in result[0]) {\n const nextTime = (result[0].time as number) * 1000;\n await this.ctx.storage.setAlarm(nextTime);\n }\n }\n\n /**\n * Method called when an alarm fires.\n * Executes any scheduled tasks that are due.\n *\n * @remarks\n * To schedule a task, please use the `this.schedule` method instead.\n * See {@link https://developers.cloudflare.com/agents/api-reference/schedule-tasks/}\n */\n public readonly alarm = async () => {\n const now = Math.floor(Date.now() / 1000);\n\n // Get all schedules that should be executed now\n const result = this.sql<Schedule<string>>`\n SELECT * FROM cf_agents_schedules WHERE time <= ${now}\n `;\n\n for (const row of result || []) {\n const callback = this[row.callback as keyof Agent<Env>];\n if (!callback) {\n console.error(`callback ${row.callback} not found`);\n continue;\n }\n await agentContext.run(\n { agent: this, connection: undefined, request: undefined },\n async () => {\n try {\n await (\n callback as (\n payload: unknown,\n schedule: Schedule<unknown>\n ) => Promise<void>\n ).bind(this)(JSON.parse(row.payload as string), row);\n } catch (e) {\n console.error(`error executing callback \"${row.callback}\"`, e);\n }\n }\n );\n if (row.type === \"cron\") {\n // Update next execution time for cron schedules\n const nextExecutionTime = getNextCronTime(row.cron);\n const nextTimestamp = Math.floor(nextExecutionTime.getTime() / 1000);\n\n this.sql`\n UPDATE cf_agents_schedules SET time = ${nextTimestamp} WHERE id = ${row.id}\n `;\n } else {\n // Delete one-time schedules after execution\n this.sql`\n DELETE FROM cf_agents_schedules WHERE id = ${row.id}\n `;\n }\n }\n\n // Schedule the next alarm\n await this._scheduleNextAlarm();\n };\n\n /**\n * Destroy the Agent, removing all state and scheduled tasks\n */\n async destroy() {\n // drop all tables\n this.sql`DROP TABLE IF EXISTS cf_agents_state`;\n this.sql`DROP TABLE IF EXISTS cf_agents_schedules`;\n this.sql`DROP TABLE IF EXISTS cf_agents_mcp_servers`;\n\n // delete all alarms\n await this.ctx.storage.deleteAlarm();\n await this.ctx.storage.deleteAll();\n this.ctx.abort(\"destroyed\"); // enforce that the agent is evicted\n }\n\n /**\n * Get all methods marked as callable on this Agent\n * @returns A map of method names to their metadata\n */\n private _isCallable(method: string): boolean {\n return callableMetadata.has(this[method as keyof this] as Function);\n }\n\n /**\n * Connect to a new MCP Server\n *\n * @param url MCP Server SSE URL\n * @param callbackHost Base host for the agent, used for the redirect URI.\n * @param agentsPrefix agents routing prefix if not using `agents`\n * @param options MCP client and transport (header) options\n * @returns authUrl\n */\n async addMcpServer(\n serverName: string,\n url: string,\n callbackHost: string,\n agentsPrefix = \"agents\",\n options?: {\n client?: ConstructorParameters<typeof Client>[1];\n transport?: {\n headers: HeadersInit;\n };\n }\n ): Promise<{ id: string; authUrl: string | undefined }> {\n const callbackUrl = `${callbackHost}/${agentsPrefix}/${camelCaseToKebabCase(this._ParentClass.name)}/${this.name}/callback`;\n\n const result = await this._connectToMcpServerInternal(\n serverName,\n url,\n callbackUrl,\n options\n );\n this.sql`\n INSERT\n OR REPLACE INTO cf_agents_mcp_servers (id, name, server_url, client_id, auth_url, callback_url, server_options)\n VALUES (\n ${result.id},\n ${serverName},\n ${url},\n ${result.clientId ?? null},\n ${result.authUrl ?? null},\n ${callbackUrl},\n ${options ? JSON.stringify(options) : null}\n );\n `;\n\n this.broadcast(\n JSON.stringify({\n mcp: this.getMcpServers(),\n type: \"cf_agent_mcp_servers\",\n })\n );\n\n return result;\n }\n\n async _connectToMcpServerInternal(\n _serverName: string,\n url: string,\n callbackUrl: string,\n // it's important that any options here are serializable because we put them into our sqlite DB for reconnection purposes\n options?: {\n client?: ConstructorParameters<typeof Client>[1];\n /**\n * We don't expose the normal set of transport options because:\n * 1) we can't serialize things like the auth provider or a fetch function into the DB for reconnection purposes\n * 2) We probably want these options to be agnostic to the transport type (SSE vs Streamable)\n *\n * This has the limitation that you can't override fetch, but I think headers should handle nearly all cases needed (i.e. non-standard bearer auth).\n */\n transport?: {\n headers?: HeadersInit;\n };\n },\n reconnect?: {\n id: string;\n oauthClientId?: string;\n }\n ): Promise<{\n id: string;\n authUrl: string | undefined;\n clientId: string | undefined;\n }> {\n const authProvider = new DurableObjectOAuthClientProvider(\n this.ctx.storage,\n this.name,\n callbackUrl\n );\n\n if (reconnect) {\n authProvider.serverId = reconnect.id;\n if (reconnect.oauthClientId) {\n authProvider.clientId = reconnect.oauthClientId;\n }\n }\n\n // allows passing through transport headers if necessary\n // this handles some non-standard bearer auth setups (i.e. MCP server behind CF access instead of OAuth)\n let headerTransportOpts: SSEClientTransportOptions = {};\n if (options?.transport?.headers) {\n headerTransportOpts = {\n eventSourceInit: {\n fetch: (url, init) =>\n fetch(url, {\n ...init,\n headers: options?.transport?.headers,\n }),\n },\n requestInit: {\n headers: options?.transport?.headers,\n },\n };\n }\n\n const { id, authUrl, clientId } = await this.mcp.connect(url, {\n client: options?.client,\n reconnect,\n transport: {\n ...headerTransportOpts,\n authProvider,\n },\n });\n\n return {\n authUrl,\n clientId,\n id,\n };\n }\n\n async removeMcpServer(id: string) {\n this.mcp.closeConnection(id);\n this.sql`\n DELETE FROM cf_agents_mcp_servers WHERE id = ${id};\n `;\n this.broadcast(\n JSON.stringify({\n mcp: this.getMcpServers(),\n type: \"cf_agent_mcp_servers\",\n })\n );\n }\n\n getMcpServers(): MCPServersState {\n const mcpState: MCPServersState = {\n prompts: this.mcp.listPrompts(),\n resources: this.mcp.listResources(),\n servers: {},\n tools: this.mcp.listTools(),\n };\n\n const servers = this.sql<MCPServerRow>`\n SELECT id, name, server_url, client_id, auth_url, callback_url, server_options FROM cf_agents_mcp_servers;\n `;\n\n for (const server of servers) {\n const serverConn = this.mcp.mcpConnections[server.id];\n mcpState.servers[server.id] = {\n auth_url: server.auth_url,\n capabilities: serverConn?.serverCapabilities ?? null,\n instructions: serverConn?.instructions ?? null,\n name: server.name,\n server_url: server.server_url,\n // mark as \"authenticating\" because the server isn't automatically connected, so it's pending authenticating\n state: serverConn?.connectionState ?? \"authenticating\",\n };\n }\n\n return mcpState;\n }\n}\n\n/**\n * Namespace for creating Agent instances\n * @template Agentic Type of the Agent class\n */\nexport type AgentNamespace<Agentic extends Agent<unknown>> =\n DurableObjectNamespace<Agentic>;\n\n/**\n * Agent's durable context\n */\nexport type AgentContext = DurableObjectState;\n\n/**\n * Configuration options for Agent routing\n */\nexport type AgentOptions<Env> = PartyServerOptions<Env> & {\n /**\n * Whether to enable CORS for the Agent\n */\n cors?: boolean | HeadersInit | undefined;\n};\n\n/**\n * Route a request to the appropriate Agent\n * @param request Request to route\n * @param env Environment containing Agent bindings\n * @param options Routing options\n * @returns Response from the Agent or undefined if no route matched\n */\nexport async function routeAgentRequest<Env>(\n request: Request,\n env: Env,\n options?: AgentOptions<Env>\n) {\n const corsHeaders =\n options?.cors === true\n ? {\n \"Access-Control-Allow-Credentials\": \"true\",\n \"Access-Control-Allow-Methods\": \"GET, POST, HEAD, OPTIONS\",\n \"Access-Control-Allow-Origin\": \"*\",\n \"Access-Control-Max-Age\": \"86400\",\n }\n : options?.cors;\n\n if (request.method === \"OPTIONS\") {\n if (corsHeaders) {\n return new Response(null, {\n headers: corsHeaders,\n });\n }\n console.warn(\n \"Received an OPTIONS request, but cors was not enabled. Pass `cors: true` or `cors: { ...custom cors headers }` to routeAgentRequest to enable CORS.\"\n );\n }\n\n let response = await routePartykitRequest(\n request,\n env as Record<string, unknown>,\n {\n prefix: \"agents\",\n ...(options as PartyServerOptions<Record<string, unknown>>),\n }\n );\n\n if (\n response &&\n corsHeaders &&\n request.headers.get(\"upgrade\")?.toLowerCase() !== \"websocket\" &&\n request.headers.get(\"Upgrade\")?.toLowerCase() !== \"websocket\"\n ) {\n response = new Response(response.body, {\n headers: {\n ...response.headers,\n ...corsHeaders,\n },\n });\n }\n return response;\n}\n\n/**\n * Route an email to the appropriate Agent\n * @param email Email message to route\n * @param env Environment containing Agent bindings\n * @param options Routing options\n */\nexport async function routeAgentEmail<Env>(\n _email: ForwardableEmailMessage,\n _env: Env,\n _options?: AgentOptions<Env>\n): Promise<void> {}\n\n/**\n * Get or create an Agent by name\n * @template Env Environment type containing bindings\n * @template T Type of the Agent class\n * @param namespace Agent namespace\n * @param name Name of the Agent instance\n * @param options Options for Agent creation\n * @returns Promise resolving to an Agent instance stub\n */\nexport async function getAgentByName<Env, T extends Agent<Env>>(\n namespace: AgentNamespace<T>,\n name: string,\n options?: {\n jurisdiction?: DurableObjectJurisdiction;\n locationHint?: DurableObjectLocationHint;\n }\n) {\n return getServerByName<Env, T>(namespace, name, options);\n}\n\n/**\n * A wrapper for streaming responses in callable methods\n */\nexport class StreamingResponse {\n private _connection: Connection;\n private _id: string;\n private _closed = false;\n\n constructor(connection: Connection, id: string) {\n this._connection = connection;\n this._id = id;\n }\n\n /**\n * Send a chunk of data to the client\n * @param chunk The data to send\n */\n send(chunk: unknown) {\n if (this._closed) {\n throw new Error(\"StreamingResponse is already closed\");\n }\n const response: RPCResponse = {\n done: false,\n id: this._id,\n result: chunk,\n success: true,\n type: \"rpc\",\n };\n this._connection.send(JSON.stringify(response));\n }\n\n /**\n * End the stream and send the final chunk (if any)\n * @param finalChunk Optional final chunk of data to send\n */\n end(finalChunk?: unknown) {\n if (this._closed) {\n throw new Error(\"StreamingResponse is already closed\");\n }\n this._closed = true;\n const response: RPCResponse = {\n done: true,\n id: this._id,\n result: finalChunk,\n success: true,\n type: \"rpc\",\n };\n this._connection.send(JSON.stringify(response));\n }\n}\n"],"mappings":";;;;;;;;;;;AAAA,SAAS,yBAAyB;AAUlC,SAAS,2BAA2B;AACpC,SAAS,cAAc;AACvB;AAAA,EAGE;A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wB,WAAW,MAAM,OAAO;AACzD;AAKO,IAAM,oBAAN,MAAwB;AAAA,EAK7B,YAAY,YAAwB,IAAY;AAFhD,SAAQ,UAAU;AAGhB,SAAK,cAAc;AACnB,SAAK,MAAM;AAAA,EACb;AAAA;AAAA;AAAA;AAAA;AAAA,EAMA,KAAK,OAAgB;AACnB,QAAI,KAAK,SAAS;AAChB,YAAM,IAAI,MAAM,qCAAqC;AAAA,IACvD;AACA,UAAM,WAAwB;AAAA,MAC5B,MAAM;AAAA,MACN,IAAI,KAAK;AAAA,MACT,QAAQ;AAAA,MACR,SAAS;AAAA,MACT,MAAM;AAAA,IACR;AACA,SAAK,YAAY,KAAK,KAAK,UAAU,QAAQ,CAAC;AAAA,EAChD;AAAA;AAAA;AAAA;AAAA;AAAA,EAMA,IAAI,YAAsB;AACxB,QAAI,KAAK,SAAS;AAChB,YAAM,IAAI,MAAM,qCAAqC;AAAA,IACvD;AACA,SAAK,UAAU;AACf,UAAM,WAAwB;AAAA,MAC5B,MAAM;AAAA,MACN,IAAI,KAAK;AAAA,MACT,QAAQ;AAAA,MACR,SAAS;AAAA,MACT,MAAM;AAAA,IACR;AACA,SAAK,YAAY,KAAK,KAAK,UAAU,QAAQ,CAAC;AAAA,EAChD;AACF;","names":["ctx","url"]}
|
package/dist/index.js
CHANGED
package/dist/mcp/client.d.ts
CHANGED
|
@@ -53,8 +53,21 @@ declare class MCPClientConnection {
|
|
|
53
53
|
properties?: {
|
|
54
54
|
[x: string]: unknown;
|
|
55
55
|
} | undefined;
|
|
56
|
+
required?: string[] | undefined;
|
|
56
57
|
};
|
|
58
|
+
_meta?: {
|
|
59
|
+
[x: string]: unknown;
|
|
60
|
+
} | undefined;
|
|
61
|
+
title?: string | undefined;
|
|
57
62
|
description?: string | undefined;
|
|
63
|
+
outputSchema?: {
|
|
64
|
+
[x: string]: unknown;
|
|
65
|
+
type: "object";
|
|
66
|
+
properties?: {
|
|
67
|
+
[x: string]: unknown;
|
|
68
|
+
} | undefined;
|
|
69
|
+
required?: string[] | undefined;
|
|
70
|
+
} | undefined;
|
|
58
71
|
annotations?: {
|
|
59
72
|
[x: string]: unknown;
|
|
60
73
|
title?: string | undefined;
|
|
@@ -68,12 +81,20 @@ declare class MCPClientConnection {
|
|
|
68
81
|
[x: string]: unknown;
|
|
69
82
|
name: string;
|
|
70
83
|
uri: string;
|
|
84
|
+
_meta?: {
|
|
85
|
+
[x: string]: unknown;
|
|
86
|
+
} | undefined;
|
|
87
|
+
title?: string | undefined;
|
|
71
88
|
description?: string | undefined;
|
|
72
89
|
mimeType?: string | undefined;
|
|
73
90
|
}[]>;
|
|
74
91
|
fetchPrompts(): Promise<{
|
|
75
92
|
[x: string]: unknown;
|
|
76
93
|
name: string;
|
|
94
|
+
_meta?: {
|
|
95
|
+
[x: string]: unknown;
|
|
96
|
+
} | undefined;
|
|
97
|
+
title?: string | undefined;
|
|
77
98
|
description?: string | undefined;
|
|
78
99
|
arguments?: {
|
|
79
100
|
[x: string]: unknown;
|
|
@@ -86,6 +107,10 @@ declare class MCPClientConnection {
|
|
|
86
107
|
[x: string]: unknown;
|
|
87
108
|
name: string;
|
|
88
109
|
uriTemplate: string;
|
|
110
|
+
_meta?: {
|
|
111
|
+
[x: string]: unknown;
|
|
112
|
+
} | undefined;
|
|
113
|
+
title?: string | undefined;
|
|
89
114
|
description?: string | undefined;
|
|
90
115
|
mimeType?: string | undefined;
|
|
91
116
|
}[]>;
|
|
@@ -168,140 +193,201 @@ declare class MCPClientManager {
|
|
|
168
193
|
}, resultSchema?: typeof CallToolResultSchema | typeof CompatibilityCallToolResultSchema, options?: RequestOptions): Promise<zod.objectOutputType<{
|
|
169
194
|
_meta: zod.ZodOptional<zod.ZodObject<{}, "passthrough", zod.ZodTypeAny, zod.objectOutputType<{}, zod.ZodTypeAny, "passthrough">, zod.objectInputType<{}, zod.ZodTypeAny, "passthrough">>>;
|
|
170
195
|
} & {
|
|
171
|
-
content: zod.ZodArray<zod.ZodUnion<[zod.ZodObject<{
|
|
196
|
+
content: zod.ZodDefault<zod.ZodArray<zod.ZodUnion<[zod.ZodObject<{
|
|
172
197
|
type: zod.ZodLiteral<"text">;
|
|
173
198
|
text: zod.ZodString;
|
|
199
|
+
_meta: zod.ZodOptional<zod.ZodObject<{}, "passthrough", zod.ZodTypeAny, zod.objectOutputType<{}, zod.ZodTypeAny, "passthrough">, zod.objectInputType<{}, zod.ZodTypeAny, "passthrough">>>;
|
|
174
200
|
}, "passthrough", zod.ZodTypeAny, zod.objectOutputType<{
|
|
175
201
|
type: zod.ZodLiteral<"text">;
|
|
176
202
|
text: zod.ZodString;
|
|
203
|
+
_meta: zod.ZodOptional<zod.ZodObject<{}, "passthrough", zod.ZodTypeAny, zod.objectOutputType<{}, zod.ZodTypeAny, "passthrough">, zod.objectInputType<{}, zod.ZodTypeAny, "passthrough">>>;
|
|
177
204
|
}, zod.ZodTypeAny, "passthrough">, zod.objectInputType<{
|
|
178
205
|
type: zod.ZodLiteral<"text">;
|
|
179
206
|
text: zod.ZodString;
|
|
207
|
+
_meta: zod.ZodOptional<zod.ZodObject<{}, "passthrough", zod.ZodTypeAny, zod.objectOutputType<{}, zod.ZodTypeAny, "passthrough">, zod.objectInputType<{}, zod.ZodTypeAny, "passthrough">>>;
|
|
180
208
|
}, zod.ZodTypeAny, "passthrough">>, zod.ZodObject<{
|
|
181
209
|
type: zod.ZodLiteral<"image">;
|
|
182
210
|
data: zod.ZodString;
|
|
183
211
|
mimeType: zod.ZodString;
|
|
212
|
+
_meta: zod.ZodOptional<zod.ZodObject<{}, "passthrough", zod.ZodTypeAny, zod.objectOutputType<{}, zod.ZodTypeAny, "passthrough">, zod.objectInputType<{}, zod.ZodTypeAny, "passthrough">>>;
|
|
184
213
|
}, "passthrough", zod.ZodTypeAny, zod.objectOutputType<{
|
|
185
214
|
type: zod.ZodLiteral<"image">;
|
|
186
215
|
data: zod.ZodString;
|
|
187
216
|
mimeType: zod.ZodString;
|
|
217
|
+
_meta: zod.ZodOptional<zod.ZodObject<{}, "passthrough", zod.ZodTypeAny, zod.objectOutputType<{}, zod.ZodTypeAny, "passthrough">, zod.objectInputType<{}, zod.ZodTypeAny, "passthrough">>>;
|
|
188
218
|
}, zod.ZodTypeAny, "passthrough">, zod.objectInputType<{
|
|
189
219
|
type: zod.ZodLiteral<"image">;
|
|
190
220
|
data: zod.ZodString;
|
|
191
221
|
mimeType: zod.ZodString;
|
|
222
|
+
_meta: zod.ZodOptional<zod.ZodObject<{}, "passthrough", zod.ZodTypeAny, zod.objectOutputType<{}, zod.ZodTypeAny, "passthrough">, zod.objectInputType<{}, zod.ZodTypeAny, "passthrough">>>;
|
|
192
223
|
}, zod.ZodTypeAny, "passthrough">>, zod.ZodObject<{
|
|
193
224
|
type: zod.ZodLiteral<"audio">;
|
|
194
225
|
data: zod.ZodString;
|
|
195
226
|
mimeType: zod.ZodString;
|
|
227
|
+
_meta: zod.ZodOptional<zod.ZodObject<{}, "passthrough", zod.ZodTypeAny, zod.objectOutputType<{}, zod.ZodTypeAny, "passthrough">, zod.objectInputType<{}, zod.ZodTypeAny, "passthrough">>>;
|
|
196
228
|
}, "passthrough", zod.ZodTypeAny, zod.objectOutputType<{
|
|
197
229
|
type: zod.ZodLiteral<"audio">;
|
|
198
230
|
data: zod.ZodString;
|
|
199
231
|
mimeType: zod.ZodString;
|
|
232
|
+
_meta: zod.ZodOptional<zod.ZodObject<{}, "passthrough", zod.ZodTypeAny, zod.objectOutputType<{}, zod.ZodTypeAny, "passthrough">, zod.objectInputType<{}, zod.ZodTypeAny, "passthrough">>>;
|
|
200
233
|
}, zod.ZodTypeAny, "passthrough">, zod.objectInputType<{
|
|
201
234
|
type: zod.ZodLiteral<"audio">;
|
|
202
235
|
data: zod.ZodString;
|
|
203
236
|
mimeType: zod.ZodString;
|
|
204
|
-
|
|
237
|
+
_meta: zod.ZodOptional<zod.ZodObject<{}, "passthrough", zod.ZodTypeAny, zod.objectOutputType<{}, zod.ZodTypeAny, "passthrough">, zod.objectInputType<{}, zod.ZodTypeAny, "passthrough">>>;
|
|
238
|
+
}, zod.ZodTypeAny, "passthrough">>, zod.ZodObject<zod.objectUtil.extendShape<zod.objectUtil.extendShape<{
|
|
239
|
+
name: zod.ZodString;
|
|
240
|
+
title: zod.ZodOptional<zod.ZodString>;
|
|
241
|
+
}, {
|
|
242
|
+
uri: zod.ZodString;
|
|
243
|
+
description: zod.ZodOptional<zod.ZodString>;
|
|
244
|
+
mimeType: zod.ZodOptional<zod.ZodString>;
|
|
245
|
+
_meta: zod.ZodOptional<zod.ZodObject<{}, "passthrough", zod.ZodTypeAny, zod.objectOutputType<{}, zod.ZodTypeAny, "passthrough">, zod.objectInputType<{}, zod.ZodTypeAny, "passthrough">>>;
|
|
246
|
+
}>, {
|
|
247
|
+
type: zod.ZodLiteral<"resource_link">;
|
|
248
|
+
}>, "passthrough", zod.ZodTypeAny, zod.objectOutputType<zod.objectUtil.extendShape<zod.objectUtil.extendShape<{
|
|
249
|
+
name: zod.ZodString;
|
|
250
|
+
title: zod.ZodOptional<zod.ZodString>;
|
|
251
|
+
}, {
|
|
252
|
+
uri: zod.ZodString;
|
|
253
|
+
description: zod.ZodOptional<zod.ZodString>;
|
|
254
|
+
mimeType: zod.ZodOptional<zod.ZodString>;
|
|
255
|
+
_meta: zod.ZodOptional<zod.ZodObject<{}, "passthrough", zod.ZodTypeAny, zod.objectOutputType<{}, zod.ZodTypeAny, "passthrough">, zod.objectInputType<{}, zod.ZodTypeAny, "passthrough">>>;
|
|
256
|
+
}>, {
|
|
257
|
+
type: zod.ZodLiteral<"resource_link">;
|
|
258
|
+
}>, zod.ZodTypeAny, "passthrough">, zod.objectInputType<zod.objectUtil.extendShape<zod.objectUtil.extendShape<{
|
|
259
|
+
name: zod.ZodString;
|
|
260
|
+
title: zod.ZodOptional<zod.ZodString>;
|
|
261
|
+
}, {
|
|
262
|
+
uri: zod.ZodString;
|
|
263
|
+
description: zod.ZodOptional<zod.ZodString>;
|
|
264
|
+
mimeType: zod.ZodOptional<zod.ZodString>;
|
|
265
|
+
_meta: zod.ZodOptional<zod.ZodObject<{}, "passthrough", zod.ZodTypeAny, zod.objectOutputType<{}, zod.ZodTypeAny, "passthrough">, zod.objectInputType<{}, zod.ZodTypeAny, "passthrough">>>;
|
|
266
|
+
}>, {
|
|
267
|
+
type: zod.ZodLiteral<"resource_link">;
|
|
268
|
+
}>, zod.ZodTypeAny, "passthrough">>, zod.ZodObject<{
|
|
205
269
|
type: zod.ZodLiteral<"resource">;
|
|
206
270
|
resource: zod.ZodUnion<[zod.ZodObject<zod.objectUtil.extendShape<{
|
|
207
271
|
uri: zod.ZodString;
|
|
208
272
|
mimeType: zod.ZodOptional<zod.ZodString>;
|
|
273
|
+
_meta: zod.ZodOptional<zod.ZodObject<{}, "passthrough", zod.ZodTypeAny, zod.objectOutputType<{}, zod.ZodTypeAny, "passthrough">, zod.objectInputType<{}, zod.ZodTypeAny, "passthrough">>>;
|
|
209
274
|
}, {
|
|
210
275
|
text: zod.ZodString;
|
|
211
276
|
}>, "passthrough", zod.ZodTypeAny, zod.objectOutputType<zod.objectUtil.extendShape<{
|
|
212
277
|
uri: zod.ZodString;
|
|
213
278
|
mimeType: zod.ZodOptional<zod.ZodString>;
|
|
279
|
+
_meta: zod.ZodOptional<zod.ZodObject<{}, "passthrough", zod.ZodTypeAny, zod.objectOutputType<{}, zod.ZodTypeAny, "passthrough">, zod.objectInputType<{}, zod.ZodTypeAny, "passthrough">>>;
|
|
214
280
|
}, {
|
|
215
281
|
text: zod.ZodString;
|
|
216
282
|
}>, zod.ZodTypeAny, "passthrough">, zod.objectInputType<zod.objectUtil.extendShape<{
|
|
217
283
|
uri: zod.ZodString;
|
|
218
284
|
mimeType: zod.ZodOptional<zod.ZodString>;
|
|
285
|
+
_meta: zod.ZodOptional<zod.ZodObject<{}, "passthrough", zod.ZodTypeAny, zod.objectOutputType<{}, zod.ZodTypeAny, "passthrough">, zod.objectInputType<{}, zod.ZodTypeAny, "passthrough">>>;
|
|
219
286
|
}, {
|
|
220
287
|
text: zod.ZodString;
|
|
221
288
|
}>, zod.ZodTypeAny, "passthrough">>, zod.ZodObject<zod.objectUtil.extendShape<{
|
|
222
289
|
uri: zod.ZodString;
|
|
223
290
|
mimeType: zod.ZodOptional<zod.ZodString>;
|
|
291
|
+
_meta: zod.ZodOptional<zod.ZodObject<{}, "passthrough", zod.ZodTypeAny, zod.objectOutputType<{}, zod.ZodTypeAny, "passthrough">, zod.objectInputType<{}, zod.ZodTypeAny, "passthrough">>>;
|
|
224
292
|
}, {
|
|
225
293
|
blob: zod.ZodString;
|
|
226
294
|
}>, "passthrough", zod.ZodTypeAny, zod.objectOutputType<zod.objectUtil.extendShape<{
|
|
227
295
|
uri: zod.ZodString;
|
|
228
296
|
mimeType: zod.ZodOptional<zod.ZodString>;
|
|
297
|
+
_meta: zod.ZodOptional<zod.ZodObject<{}, "passthrough", zod.ZodTypeAny, zod.objectOutputType<{}, zod.ZodTypeAny, "passthrough">, zod.objectInputType<{}, zod.ZodTypeAny, "passthrough">>>;
|
|
229
298
|
}, {
|
|
230
299
|
blob: zod.ZodString;
|
|
231
300
|
}>, zod.ZodTypeAny, "passthrough">, zod.objectInputType<zod.objectUtil.extendShape<{
|
|
232
301
|
uri: zod.ZodString;
|
|
233
302
|
mimeType: zod.ZodOptional<zod.ZodString>;
|
|
303
|
+
_meta: zod.ZodOptional<zod.ZodObject<{}, "passthrough", zod.ZodTypeAny, zod.objectOutputType<{}, zod.ZodTypeAny, "passthrough">, zod.objectInputType<{}, zod.ZodTypeAny, "passthrough">>>;
|
|
234
304
|
}, {
|
|
235
305
|
blob: zod.ZodString;
|
|
236
306
|
}>, zod.ZodTypeAny, "passthrough">>]>;
|
|
307
|
+
_meta: zod.ZodOptional<zod.ZodObject<{}, "passthrough", zod.ZodTypeAny, zod.objectOutputType<{}, zod.ZodTypeAny, "passthrough">, zod.objectInputType<{}, zod.ZodTypeAny, "passthrough">>>;
|
|
237
308
|
}, "passthrough", zod.ZodTypeAny, zod.objectOutputType<{
|
|
238
309
|
type: zod.ZodLiteral<"resource">;
|
|
239
310
|
resource: zod.ZodUnion<[zod.ZodObject<zod.objectUtil.extendShape<{
|
|
240
311
|
uri: zod.ZodString;
|
|
241
312
|
mimeType: zod.ZodOptional<zod.ZodString>;
|
|
313
|
+
_meta: zod.ZodOptional<zod.ZodObject<{}, "passthrough", zod.ZodTypeAny, zod.objectOutputType<{}, zod.ZodTypeAny, "passthrough">, zod.objectInputType<{}, zod.ZodTypeAny, "passthrough">>>;
|
|
242
314
|
}, {
|
|
243
315
|
text: zod.ZodString;
|
|
244
316
|
}>, "passthrough", zod.ZodTypeAny, zod.objectOutputType<zod.objectUtil.extendShape<{
|
|
245
317
|
uri: zod.ZodString;
|
|
246
318
|
mimeType: zod.ZodOptional<zod.ZodString>;
|
|
319
|
+
_meta: zod.ZodOptional<zod.ZodObject<{}, "passthrough", zod.ZodTypeAny, zod.objectOutputType<{}, zod.ZodTypeAny, "passthrough">, zod.objectInputType<{}, zod.ZodTypeAny, "passthrough">>>;
|
|
247
320
|
}, {
|
|
248
321
|
text: zod.ZodString;
|
|
249
322
|
}>, zod.ZodTypeAny, "passthrough">, zod.objectInputType<zod.objectUtil.extendShape<{
|
|
250
323
|
uri: zod.ZodString;
|
|
251
324
|
mimeType: zod.ZodOptional<zod.ZodString>;
|
|
325
|
+
_meta: zod.ZodOptional<zod.ZodObject<{}, "passthrough", zod.ZodTypeAny, zod.objectOutputType<{}, zod.ZodTypeAny, "passthrough">, zod.objectInputType<{}, zod.ZodTypeAny, "passthrough">>>;
|
|
252
326
|
}, {
|
|
253
327
|
text: zod.ZodString;
|
|
254
328
|
}>, zod.ZodTypeAny, "passthrough">>, zod.ZodObject<zod.objectUtil.extendShape<{
|
|
255
329
|
uri: zod.ZodString;
|
|
256
330
|
mimeType: zod.ZodOptional<zod.ZodString>;
|
|
331
|
+
_meta: zod.ZodOptional<zod.ZodObject<{}, "passthrough", zod.ZodTypeAny, zod.objectOutputType<{}, zod.ZodTypeAny, "passthrough">, zod.objectInputType<{}, zod.ZodTypeAny, "passthrough">>>;
|
|
257
332
|
}, {
|
|
258
333
|
blob: zod.ZodString;
|
|
259
334
|
}>, "passthrough", zod.ZodTypeAny, zod.objectOutputType<zod.objectUtil.extendShape<{
|
|
260
335
|
uri: zod.ZodString;
|
|
261
336
|
mimeType: zod.ZodOptional<zod.ZodString>;
|
|
337
|
+
_meta: zod.ZodOptional<zod.ZodObject<{}, "passthrough", zod.ZodTypeAny, zod.objectOutputType<{}, zod.ZodTypeAny, "passthrough">, zod.objectInputType<{}, zod.ZodTypeAny, "passthrough">>>;
|
|
262
338
|
}, {
|
|
263
339
|
blob: zod.ZodString;
|
|
264
340
|
}>, zod.ZodTypeAny, "passthrough">, zod.objectInputType<zod.objectUtil.extendShape<{
|
|
265
341
|
uri: zod.ZodString;
|
|
266
342
|
mimeType: zod.ZodOptional<zod.ZodString>;
|
|
343
|
+
_meta: zod.ZodOptional<zod.ZodObject<{}, "passthrough", zod.ZodTypeAny, zod.objectOutputType<{}, zod.ZodTypeAny, "passthrough">, zod.objectInputType<{}, zod.ZodTypeAny, "passthrough">>>;
|
|
267
344
|
}, {
|
|
268
345
|
blob: zod.ZodString;
|
|
269
346
|
}>, zod.ZodTypeAny, "passthrough">>]>;
|
|
347
|
+
_meta: zod.ZodOptional<zod.ZodObject<{}, "passthrough", zod.ZodTypeAny, zod.objectOutputType<{}, zod.ZodTypeAny, "passthrough">, zod.objectInputType<{}, zod.ZodTypeAny, "passthrough">>>;
|
|
270
348
|
}, zod.ZodTypeAny, "passthrough">, zod.objectInputType<{
|
|
271
349
|
type: zod.ZodLiteral<"resource">;
|
|
272
350
|
resource: zod.ZodUnion<[zod.ZodObject<zod.objectUtil.extendShape<{
|
|
273
351
|
uri: zod.ZodString;
|
|
274
352
|
mimeType: zod.ZodOptional<zod.ZodString>;
|
|
353
|
+
_meta: zod.ZodOptional<zod.ZodObject<{}, "passthrough", zod.ZodTypeAny, zod.objectOutputType<{}, zod.ZodTypeAny, "passthrough">, zod.objectInputType<{}, zod.ZodTypeAny, "passthrough">>>;
|
|
275
354
|
}, {
|
|
276
355
|
text: zod.ZodString;
|
|
277
356
|
}>, "passthrough", zod.ZodTypeAny, zod.objectOutputType<zod.objectUtil.extendShape<{
|
|
278
357
|
uri: zod.ZodString;
|
|
279
358
|
mimeType: zod.ZodOptional<zod.ZodString>;
|
|
359
|
+
_meta: zod.ZodOptional<zod.ZodObject<{}, "passthrough", zod.ZodTypeAny, zod.objectOutputType<{}, zod.ZodTypeAny, "passthrough">, zod.objectInputType<{}, zod.ZodTypeAny, "passthrough">>>;
|
|
280
360
|
}, {
|
|
281
361
|
text: zod.ZodString;
|
|
282
362
|
}>, zod.ZodTypeAny, "passthrough">, zod.objectInputType<zod.objectUtil.extendShape<{
|
|
283
363
|
uri: zod.ZodString;
|
|
284
364
|
mimeType: zod.ZodOptional<zod.ZodString>;
|
|
365
|
+
_meta: zod.ZodOptional<zod.ZodObject<{}, "passthrough", zod.ZodTypeAny, zod.objectOutputType<{}, zod.ZodTypeAny, "passthrough">, zod.objectInputType<{}, zod.ZodTypeAny, "passthrough">>>;
|
|
285
366
|
}, {
|
|
286
367
|
text: zod.ZodString;
|
|
287
368
|
}>, zod.ZodTypeAny, "passthrough">>, zod.ZodObject<zod.objectUtil.extendShape<{
|
|
288
369
|
uri: zod.ZodString;
|
|
289
370
|
mimeType: zod.ZodOptional<zod.ZodString>;
|
|
371
|
+
_meta: zod.ZodOptional<zod.ZodObject<{}, "passthrough", zod.ZodTypeAny, zod.objectOutputType<{}, zod.ZodTypeAny, "passthrough">, zod.objectInputType<{}, zod.ZodTypeAny, "passthrough">>>;
|
|
290
372
|
}, {
|
|
291
373
|
blob: zod.ZodString;
|
|
292
374
|
}>, "passthrough", zod.ZodTypeAny, zod.objectOutputType<zod.objectUtil.extendShape<{
|
|
293
375
|
uri: zod.ZodString;
|
|
294
376
|
mimeType: zod.ZodOptional<zod.ZodString>;
|
|
377
|
+
_meta: zod.ZodOptional<zod.ZodObject<{}, "passthrough", zod.ZodTypeAny, zod.objectOutputType<{}, zod.ZodTypeAny, "passthrough">, zod.objectInputType<{}, zod.ZodTypeAny, "passthrough">>>;
|
|
295
378
|
}, {
|
|
296
379
|
blob: zod.ZodString;
|
|
297
380
|
}>, zod.ZodTypeAny, "passthrough">, zod.objectInputType<zod.objectUtil.extendShape<{
|
|
298
381
|
uri: zod.ZodString;
|
|
299
382
|
mimeType: zod.ZodOptional<zod.ZodString>;
|
|
383
|
+
_meta: zod.ZodOptional<zod.ZodObject<{}, "passthrough", zod.ZodTypeAny, zod.objectOutputType<{}, zod.ZodTypeAny, "passthrough">, zod.objectInputType<{}, zod.ZodTypeAny, "passthrough">>>;
|
|
300
384
|
}, {
|
|
301
385
|
blob: zod.ZodString;
|
|
302
386
|
}>, zod.ZodTypeAny, "passthrough">>]>;
|
|
303
|
-
|
|
304
|
-
|
|
387
|
+
_meta: zod.ZodOptional<zod.ZodObject<{}, "passthrough", zod.ZodTypeAny, zod.objectOutputType<{}, zod.ZodTypeAny, "passthrough">, zod.objectInputType<{}, zod.ZodTypeAny, "passthrough">>>;
|
|
388
|
+
}, zod.ZodTypeAny, "passthrough">>]>, "many">>;
|
|
389
|
+
structuredContent: zod.ZodOptional<zod.ZodObject<{}, "passthrough", zod.ZodTypeAny, zod.objectOutputType<{}, zod.ZodTypeAny, "passthrough">, zod.objectInputType<{}, zod.ZodTypeAny, "passthrough">>>;
|
|
390
|
+
isError: zod.ZodOptional<zod.ZodBoolean>;
|
|
305
391
|
}, zod.ZodTypeAny, "passthrough"> | zod.objectOutputType<{
|
|
306
392
|
_meta: zod.ZodOptional<zod.ZodObject<{}, "passthrough", zod.ZodTypeAny, zod.objectOutputType<{}, zod.ZodTypeAny, "passthrough">, zod.objectInputType<{}, zod.ZodTypeAny, "passthrough">>>;
|
|
307
393
|
} & {
|
|
@@ -318,31 +404,37 @@ declare class MCPClientManager {
|
|
|
318
404
|
contents: zod.ZodArray<zod.ZodUnion<[zod.ZodObject<zod.objectUtil.extendShape<{
|
|
319
405
|
uri: zod.ZodString;
|
|
320
406
|
mimeType: zod.ZodOptional<zod.ZodString>;
|
|
407
|
+
_meta: zod.ZodOptional<zod.ZodObject<{}, "passthrough", zod.ZodTypeAny, zod.objectOutputType<{}, zod.ZodTypeAny, "passthrough">, zod.objectInputType<{}, zod.ZodTypeAny, "passthrough">>>;
|
|
321
408
|
}, {
|
|
322
409
|
text: zod.ZodString;
|
|
323
410
|
}>, "passthrough", zod.ZodTypeAny, zod.objectOutputType<zod.objectUtil.extendShape<{
|
|
324
411
|
uri: zod.ZodString;
|
|
325
412
|
mimeType: zod.ZodOptional<zod.ZodString>;
|
|
413
|
+
_meta: zod.ZodOptional<zod.ZodObject<{}, "passthrough", zod.ZodTypeAny, zod.objectOutputType<{}, zod.ZodTypeAny, "passthrough">, zod.objectInputType<{}, zod.ZodTypeAny, "passthrough">>>;
|
|
326
414
|
}, {
|
|
327
415
|
text: zod.ZodString;
|
|
328
416
|
}>, zod.ZodTypeAny, "passthrough">, zod.objectInputType<zod.objectUtil.extendShape<{
|
|
329
417
|
uri: zod.ZodString;
|
|
330
418
|
mimeType: zod.ZodOptional<zod.ZodString>;
|
|
419
|
+
_meta: zod.ZodOptional<zod.ZodObject<{}, "passthrough", zod.ZodTypeAny, zod.objectOutputType<{}, zod.ZodTypeAny, "passthrough">, zod.objectInputType<{}, zod.ZodTypeAny, "passthrough">>>;
|
|
331
420
|
}, {
|
|
332
421
|
text: zod.ZodString;
|
|
333
422
|
}>, zod.ZodTypeAny, "passthrough">>, zod.ZodObject<zod.objectUtil.extendShape<{
|
|
334
423
|
uri: zod.ZodString;
|
|
335
424
|
mimeType: zod.ZodOptional<zod.ZodString>;
|
|
425
|
+
_meta: zod.ZodOptional<zod.ZodObject<{}, "passthrough", zod.ZodTypeAny, zod.objectOutputType<{}, zod.ZodTypeAny, "passthrough">, zod.objectInputType<{}, zod.ZodTypeAny, "passthrough">>>;
|
|
336
426
|
}, {
|
|
337
427
|
blob: zod.ZodString;
|
|
338
428
|
}>, "passthrough", zod.ZodTypeAny, zod.objectOutputType<zod.objectUtil.extendShape<{
|
|
339
429
|
uri: zod.ZodString;
|
|
340
430
|
mimeType: zod.ZodOptional<zod.ZodString>;
|
|
431
|
+
_meta: zod.ZodOptional<zod.ZodObject<{}, "passthrough", zod.ZodTypeAny, zod.objectOutputType<{}, zod.ZodTypeAny, "passthrough">, zod.objectInputType<{}, zod.ZodTypeAny, "passthrough">>>;
|
|
341
432
|
}, {
|
|
342
433
|
blob: zod.ZodString;
|
|
343
434
|
}>, zod.ZodTypeAny, "passthrough">, zod.objectInputType<zod.objectUtil.extendShape<{
|
|
344
435
|
uri: zod.ZodString;
|
|
345
436
|
mimeType: zod.ZodOptional<zod.ZodString>;
|
|
437
|
+
_meta: zod.ZodOptional<zod.ZodObject<{}, "passthrough", zod.ZodTypeAny, zod.objectOutputType<{}, zod.ZodTypeAny, "passthrough">, zod.objectInputType<{}, zod.ZodTypeAny, "passthrough">>>;
|
|
346
438
|
}, {
|
|
347
439
|
blob: zod.ZodString;
|
|
348
440
|
}>, zod.ZodTypeAny, "passthrough">>]>, "many">;
|
|
@@ -361,405 +453,585 @@ declare class MCPClientManager {
|
|
|
361
453
|
content: zod.ZodUnion<[zod.ZodObject<{
|
|
362
454
|
type: zod.ZodLiteral<"text">;
|
|
363
455
|
text: zod.ZodString;
|
|
456
|
+
_meta: zod.ZodOptional<zod.ZodObject<{}, "passthrough", zod.ZodTypeAny, zod.objectOutputType<{}, zod.ZodTypeAny, "passthrough">, zod.objectInputType<{}, zod.ZodTypeAny, "passthrough">>>;
|
|
364
457
|
}, "passthrough", zod.ZodTypeAny, zod.objectOutputType<{
|
|
365
458
|
type: zod.ZodLiteral<"text">;
|
|
366
459
|
text: zod.ZodString;
|
|
460
|
+
_meta: zod.ZodOptional<zod.ZodObject<{}, "passthrough", zod.ZodTypeAny, zod.objectOutputType<{}, zod.ZodTypeAny, "passthrough">, zod.objectInputType<{}, zod.ZodTypeAny, "passthrough">>>;
|
|
367
461
|
}, zod.ZodTypeAny, "passthrough">, zod.objectInputType<{
|
|
368
462
|
type: zod.ZodLiteral<"text">;
|
|
369
463
|
text: zod.ZodString;
|
|
464
|
+
_meta: zod.ZodOptional<zod.ZodObject<{}, "passthrough", zod.ZodTypeAny, zod.objectOutputType<{}, zod.ZodTypeAny, "passthrough">, zod.objectInputType<{}, zod.ZodTypeAny, "passthrough">>>;
|
|
370
465
|
}, zod.ZodTypeAny, "passthrough">>, zod.ZodObject<{
|
|
371
466
|
type: zod.ZodLiteral<"image">;
|
|
372
467
|
data: zod.ZodString;
|
|
373
468
|
mimeType: zod.ZodString;
|
|
469
|
+
_meta: zod.ZodOptional<zod.ZodObject<{}, "passthrough", zod.ZodTypeAny, zod.objectOutputType<{}, zod.ZodTypeAny, "passthrough">, zod.objectInputType<{}, zod.ZodTypeAny, "passthrough">>>;
|
|
374
470
|
}, "passthrough", zod.ZodTypeAny, zod.objectOutputType<{
|
|
375
471
|
type: zod.ZodLiteral<"image">;
|
|
376
472
|
data: zod.ZodString;
|
|
377
473
|
mimeType: zod.ZodString;
|
|
474
|
+
_meta: zod.ZodOptional<zod.ZodObject<{}, "passthrough", zod.ZodTypeAny, zod.objectOutputType<{}, zod.ZodTypeAny, "passthrough">, zod.objectInputType<{}, zod.ZodTypeAny, "passthrough">>>;
|
|
378
475
|
}, zod.ZodTypeAny, "passthrough">, zod.objectInputType<{
|
|
379
476
|
type: zod.ZodLiteral<"image">;
|
|
380
477
|
data: zod.ZodString;
|
|
381
478
|
mimeType: zod.ZodString;
|
|
479
|
+
_meta: zod.ZodOptional<zod.ZodObject<{}, "passthrough", zod.ZodTypeAny, zod.objectOutputType<{}, zod.ZodTypeAny, "passthrough">, zod.objectInputType<{}, zod.ZodTypeAny, "passthrough">>>;
|
|
382
480
|
}, zod.ZodTypeAny, "passthrough">>, zod.ZodObject<{
|
|
383
481
|
type: zod.ZodLiteral<"audio">;
|
|
384
482
|
data: zod.ZodString;
|
|
385
483
|
mimeType: zod.ZodString;
|
|
484
|
+
_meta: zod.ZodOptional<zod.ZodObject<{}, "passthrough", zod.ZodTypeAny, zod.objectOutputType<{}, zod.ZodTypeAny, "passthrough">, zod.objectInputType<{}, zod.ZodTypeAny, "passthrough">>>;
|
|
386
485
|
}, "passthrough", zod.ZodTypeAny, zod.objectOutputType<{
|
|
387
486
|
type: zod.ZodLiteral<"audio">;
|
|
388
487
|
data: zod.ZodString;
|
|
389
488
|
mimeType: zod.ZodString;
|
|
489
|
+
_meta: zod.ZodOptional<zod.ZodObject<{}, "passthrough", zod.ZodTypeAny, zod.objectOutputType<{}, zod.ZodTypeAny, "passthrough">, zod.objectInputType<{}, zod.ZodTypeAny, "passthrough">>>;
|
|
390
490
|
}, zod.ZodTypeAny, "passthrough">, zod.objectInputType<{
|
|
391
491
|
type: zod.ZodLiteral<"audio">;
|
|
392
492
|
data: zod.ZodString;
|
|
393
493
|
mimeType: zod.ZodString;
|
|
394
|
-
|
|
494
|
+
_meta: zod.ZodOptional<zod.ZodObject<{}, "passthrough", zod.ZodTypeAny, zod.objectOutputType<{}, zod.ZodTypeAny, "passthrough">, zod.objectInputType<{}, zod.ZodTypeAny, "passthrough">>>;
|
|
495
|
+
}, zod.ZodTypeAny, "passthrough">>, zod.ZodObject<zod.objectUtil.extendShape<zod.objectUtil.extendShape<{
|
|
496
|
+
name: zod.ZodString;
|
|
497
|
+
title: zod.ZodOptional<zod.ZodString>;
|
|
498
|
+
}, {
|
|
499
|
+
uri: zod.ZodString;
|
|
500
|
+
description: zod.ZodOptional<zod.ZodString>;
|
|
501
|
+
mimeType: zod.ZodOptional<zod.ZodString>;
|
|
502
|
+
_meta: zod.ZodOptional<zod.ZodObject<{}, "passthrough", zod.ZodTypeAny, zod.objectOutputType<{}, zod.ZodTypeAny, "passthrough">, zod.objectInputType<{}, zod.ZodTypeAny, "passthrough">>>;
|
|
503
|
+
}>, {
|
|
504
|
+
type: zod.ZodLiteral<"resource_link">;
|
|
505
|
+
}>, "passthrough", zod.ZodTypeAny, zod.objectOutputType<zod.objectUtil.extendShape<zod.objectUtil.extendShape<{
|
|
506
|
+
name: zod.ZodString;
|
|
507
|
+
title: zod.ZodOptional<zod.ZodString>;
|
|
508
|
+
}, {
|
|
509
|
+
uri: zod.ZodString;
|
|
510
|
+
description: zod.ZodOptional<zod.ZodString>;
|
|
511
|
+
mimeType: zod.ZodOptional<zod.ZodString>;
|
|
512
|
+
_meta: zod.ZodOptional<zod.ZodObject<{}, "passthrough", zod.ZodTypeAny, zod.objectOutputType<{}, zod.ZodTypeAny, "passthrough">, zod.objectInputType<{}, zod.ZodTypeAny, "passthrough">>>;
|
|
513
|
+
}>, {
|
|
514
|
+
type: zod.ZodLiteral<"resource_link">;
|
|
515
|
+
}>, zod.ZodTypeAny, "passthrough">, zod.objectInputType<zod.objectUtil.extendShape<zod.objectUtil.extendShape<{
|
|
516
|
+
name: zod.ZodString;
|
|
517
|
+
title: zod.ZodOptional<zod.ZodString>;
|
|
518
|
+
}, {
|
|
519
|
+
uri: zod.ZodString;
|
|
520
|
+
description: zod.ZodOptional<zod.ZodString>;
|
|
521
|
+
mimeType: zod.ZodOptional<zod.ZodString>;
|
|
522
|
+
_meta: zod.ZodOptional<zod.ZodObject<{}, "passthrough", zod.ZodTypeAny, zod.objectOutputType<{}, zod.ZodTypeAny, "passthrough">, zod.objectInputType<{}, zod.ZodTypeAny, "passthrough">>>;
|
|
523
|
+
}>, {
|
|
524
|
+
type: zod.ZodLiteral<"resource_link">;
|
|
525
|
+
}>, zod.ZodTypeAny, "passthrough">>, zod.ZodObject<{
|
|
395
526
|
type: zod.ZodLiteral<"resource">;
|
|
396
527
|
resource: zod.ZodUnion<[zod.ZodObject<zod.objectUtil.extendShape<{
|
|
397
528
|
uri: zod.ZodString;
|
|
398
529
|
mimeType: zod.ZodOptional<zod.ZodString>;
|
|
530
|
+
_meta: zod.ZodOptional<zod.ZodObject<{}, "passthrough", zod.ZodTypeAny, zod.objectOutputType<{}, zod.ZodTypeAny, "passthrough">, zod.objectInputType<{}, zod.ZodTypeAny, "passthrough">>>;
|
|
399
531
|
}, {
|
|
400
532
|
text: zod.ZodString;
|
|
401
533
|
}>, "passthrough", zod.ZodTypeAny, zod.objectOutputType<zod.objectUtil.extendShape<{
|
|
402
534
|
uri: zod.ZodString;
|
|
403
535
|
mimeType: zod.ZodOptional<zod.ZodString>;
|
|
536
|
+
_meta: zod.ZodOptional<zod.ZodObject<{}, "passthrough", zod.ZodTypeAny, zod.objectOutputType<{}, zod.ZodTypeAny, "passthrough">, zod.objectInputType<{}, zod.ZodTypeAny, "passthrough">>>;
|
|
404
537
|
}, {
|
|
405
538
|
text: zod.ZodString;
|
|
406
539
|
}>, zod.ZodTypeAny, "passthrough">, zod.objectInputType<zod.objectUtil.extendShape<{
|
|
407
540
|
uri: zod.ZodString;
|
|
408
541
|
mimeType: zod.ZodOptional<zod.ZodString>;
|
|
542
|
+
_meta: zod.ZodOptional<zod.ZodObject<{}, "passthrough", zod.ZodTypeAny, zod.objectOutputType<{}, zod.ZodTypeAny, "passthrough">, zod.objectInputType<{}, zod.ZodTypeAny, "passthrough">>>;
|
|
409
543
|
}, {
|
|
410
544
|
text: zod.ZodString;
|
|
411
545
|
}>, zod.ZodTypeAny, "passthrough">>, zod.ZodObject<zod.objectUtil.extendShape<{
|
|
412
546
|
uri: zod.ZodString;
|
|
413
547
|
mimeType: zod.ZodOptional<zod.ZodString>;
|
|
548
|
+
_meta: zod.ZodOptional<zod.ZodObject<{}, "passthrough", zod.ZodTypeAny, zod.objectOutputType<{}, zod.ZodTypeAny, "passthrough">, zod.objectInputType<{}, zod.ZodTypeAny, "passthrough">>>;
|
|
414
549
|
}, {
|
|
415
550
|
blob: zod.ZodString;
|
|
416
551
|
}>, "passthrough", zod.ZodTypeAny, zod.objectOutputType<zod.objectUtil.extendShape<{
|
|
417
552
|
uri: zod.ZodString;
|
|
418
553
|
mimeType: zod.ZodOptional<zod.ZodString>;
|
|
554
|
+
_meta: zod.ZodOptional<zod.ZodObject<{}, "passthrough", zod.ZodTypeAny, zod.objectOutputType<{}, zod.ZodTypeAny, "passthrough">, zod.objectInputType<{}, zod.ZodTypeAny, "passthrough">>>;
|
|
419
555
|
}, {
|
|
420
556
|
blob: zod.ZodString;
|
|
421
557
|
}>, zod.ZodTypeAny, "passthrough">, zod.objectInputType<zod.objectUtil.extendShape<{
|
|
422
558
|
uri: zod.ZodString;
|
|
423
559
|
mimeType: zod.ZodOptional<zod.ZodString>;
|
|
560
|
+
_meta: zod.ZodOptional<zod.ZodObject<{}, "passthrough", zod.ZodTypeAny, zod.objectOutputType<{}, zod.ZodTypeAny, "passthrough">, zod.objectInputType<{}, zod.ZodTypeAny, "passthrough">>>;
|
|
424
561
|
}, {
|
|
425
562
|
blob: zod.ZodString;
|
|
426
563
|
}>, zod.ZodTypeAny, "passthrough">>]>;
|
|
564
|
+
_meta: zod.ZodOptional<zod.ZodObject<{}, "passthrough", zod.ZodTypeAny, zod.objectOutputType<{}, zod.ZodTypeAny, "passthrough">, zod.objectInputType<{}, zod.ZodTypeAny, "passthrough">>>;
|
|
427
565
|
}, "passthrough", zod.ZodTypeAny, zod.objectOutputType<{
|
|
428
566
|
type: zod.ZodLiteral<"resource">;
|
|
429
567
|
resource: zod.ZodUnion<[zod.ZodObject<zod.objectUtil.extendShape<{
|
|
430
568
|
uri: zod.ZodString;
|
|
431
569
|
mimeType: zod.ZodOptional<zod.ZodString>;
|
|
570
|
+
_meta: zod.ZodOptional<zod.ZodObject<{}, "passthrough", zod.ZodTypeAny, zod.objectOutputType<{}, zod.ZodTypeAny, "passthrough">, zod.objectInputType<{}, zod.ZodTypeAny, "passthrough">>>;
|
|
432
571
|
}, {
|
|
433
572
|
text: zod.ZodString;
|
|
434
573
|
}>, "passthrough", zod.ZodTypeAny, zod.objectOutputType<zod.objectUtil.extendShape<{
|
|
435
574
|
uri: zod.ZodString;
|
|
436
575
|
mimeType: zod.ZodOptional<zod.ZodString>;
|
|
576
|
+
_meta: zod.ZodOptional<zod.ZodObject<{}, "passthrough", zod.ZodTypeAny, zod.objectOutputType<{}, zod.ZodTypeAny, "passthrough">, zod.objectInputType<{}, zod.ZodTypeAny, "passthrough">>>;
|
|
437
577
|
}, {
|
|
438
578
|
text: zod.ZodString;
|
|
439
579
|
}>, zod.ZodTypeAny, "passthrough">, zod.objectInputType<zod.objectUtil.extendShape<{
|
|
440
580
|
uri: zod.ZodString;
|
|
441
581
|
mimeType: zod.ZodOptional<zod.ZodString>;
|
|
582
|
+
_meta: zod.ZodOptional<zod.ZodObject<{}, "passthrough", zod.ZodTypeAny, zod.objectOutputType<{}, zod.ZodTypeAny, "passthrough">, zod.objectInputType<{}, zod.ZodTypeAny, "passthrough">>>;
|
|
442
583
|
}, {
|
|
443
584
|
text: zod.ZodString;
|
|
444
585
|
}>, zod.ZodTypeAny, "passthrough">>, zod.ZodObject<zod.objectUtil.extendShape<{
|
|
445
586
|
uri: zod.ZodString;
|
|
446
587
|
mimeType: zod.ZodOptional<zod.ZodString>;
|
|
588
|
+
_meta: zod.ZodOptional<zod.ZodObject<{}, "passthrough", zod.ZodTypeAny, zod.objectOutputType<{}, zod.ZodTypeAny, "passthrough">, zod.objectInputType<{}, zod.ZodTypeAny, "passthrough">>>;
|
|
447
589
|
}, {
|
|
448
590
|
blob: zod.ZodString;
|
|
449
591
|
}>, "passthrough", zod.ZodTypeAny, zod.objectOutputType<zod.objectUtil.extendShape<{
|
|
450
592
|
uri: zod.ZodString;
|
|
451
593
|
mimeType: zod.ZodOptional<zod.ZodString>;
|
|
594
|
+
_meta: zod.ZodOptional<zod.ZodObject<{}, "passthrough", zod.ZodTypeAny, zod.objectOutputType<{}, zod.ZodTypeAny, "passthrough">, zod.objectInputType<{}, zod.ZodTypeAny, "passthrough">>>;
|
|
452
595
|
}, {
|
|
453
596
|
blob: zod.ZodString;
|
|
454
597
|
}>, zod.ZodTypeAny, "passthrough">, zod.objectInputType<zod.objectUtil.extendShape<{
|
|
455
598
|
uri: zod.ZodString;
|
|
456
599
|
mimeType: zod.ZodOptional<zod.ZodString>;
|
|
600
|
+
_meta: zod.ZodOptional<zod.ZodObject<{}, "passthrough", zod.ZodTypeAny, zod.objectOutputType<{}, zod.ZodTypeAny, "passthrough">, zod.objectInputType<{}, zod.ZodTypeAny, "passthrough">>>;
|
|
457
601
|
}, {
|
|
458
602
|
blob: zod.ZodString;
|
|
459
603
|
}>, zod.ZodTypeAny, "passthrough">>]>;
|
|
604
|
+
_meta: zod.ZodOptional<zod.ZodObject<{}, "passthrough", zod.ZodTypeAny, zod.objectOutputType<{}, zod.ZodTypeAny, "passthrough">, zod.objectInputType<{}, zod.ZodTypeAny, "passthrough">>>;
|
|
460
605
|
}, zod.ZodTypeAny, "passthrough">, zod.objectInputType<{
|
|
461
606
|
type: zod.ZodLiteral<"resource">;
|
|
462
607
|
resource: zod.ZodUnion<[zod.ZodObject<zod.objectUtil.extendShape<{
|
|
463
608
|
uri: zod.ZodString;
|
|
464
609
|
mimeType: zod.ZodOptional<zod.ZodString>;
|
|
610
|
+
_meta: zod.ZodOptional<zod.ZodObject<{}, "passthrough", zod.ZodTypeAny, zod.objectOutputType<{}, zod.ZodTypeAny, "passthrough">, zod.objectInputType<{}, zod.ZodTypeAny, "passthrough">>>;
|
|
465
611
|
}, {
|
|
466
612
|
text: zod.ZodString;
|
|
467
613
|
}>, "passthrough", zod.ZodTypeAny, zod.objectOutputType<zod.objectUtil.extendShape<{
|
|
468
614
|
uri: zod.ZodString;
|
|
469
615
|
mimeType: zod.ZodOptional<zod.ZodString>;
|
|
616
|
+
_meta: zod.ZodOptional<zod.ZodObject<{}, "passthrough", zod.ZodTypeAny, zod.objectOutputType<{}, zod.ZodTypeAny, "passthrough">, zod.objectInputType<{}, zod.ZodTypeAny, "passthrough">>>;
|
|
470
617
|
}, {
|
|
471
618
|
text: zod.ZodString;
|
|
472
619
|
}>, zod.ZodTypeAny, "passthrough">, zod.objectInputType<zod.objectUtil.extendShape<{
|
|
473
620
|
uri: zod.ZodString;
|
|
474
621
|
mimeType: zod.ZodOptional<zod.ZodString>;
|
|
622
|
+
_meta: zod.ZodOptional<zod.ZodObject<{}, "passthrough", zod.ZodTypeAny, zod.objectOutputType<{}, zod.ZodTypeAny, "passthrough">, zod.objectInputType<{}, zod.ZodTypeAny, "passthrough">>>;
|
|
475
623
|
}, {
|
|
476
624
|
text: zod.ZodString;
|
|
477
625
|
}>, zod.ZodTypeAny, "passthrough">>, zod.ZodObject<zod.objectUtil.extendShape<{
|
|
478
626
|
uri: zod.ZodString;
|
|
479
627
|
mimeType: zod.ZodOptional<zod.ZodString>;
|
|
628
|
+
_meta: zod.ZodOptional<zod.ZodObject<{}, "passthrough", zod.ZodTypeAny, zod.objectOutputType<{}, zod.ZodTypeAny, "passthrough">, zod.objectInputType<{}, zod.ZodTypeAny, "passthrough">>>;
|
|
480
629
|
}, {
|
|
481
630
|
blob: zod.ZodString;
|
|
482
631
|
}>, "passthrough", zod.ZodTypeAny, zod.objectOutputType<zod.objectUtil.extendShape<{
|
|
483
632
|
uri: zod.ZodString;
|
|
484
633
|
mimeType: zod.ZodOptional<zod.ZodString>;
|
|
634
|
+
_meta: zod.ZodOptional<zod.ZodObject<{}, "passthrough", zod.ZodTypeAny, zod.objectOutputType<{}, zod.ZodTypeAny, "passthrough">, zod.objectInputType<{}, zod.ZodTypeAny, "passthrough">>>;
|
|
485
635
|
}, {
|
|
486
636
|
blob: zod.ZodString;
|
|
487
637
|
}>, zod.ZodTypeAny, "passthrough">, zod.objectInputType<zod.objectUtil.extendShape<{
|
|
488
638
|
uri: zod.ZodString;
|
|
489
639
|
mimeType: zod.ZodOptional<zod.ZodString>;
|
|
640
|
+
_meta: zod.ZodOptional<zod.ZodObject<{}, "passthrough", zod.ZodTypeAny, zod.objectOutputType<{}, zod.ZodTypeAny, "passthrough">, zod.objectInputType<{}, zod.ZodTypeAny, "passthrough">>>;
|
|
490
641
|
}, {
|
|
491
642
|
blob: zod.ZodString;
|
|
492
643
|
}>, zod.ZodTypeAny, "passthrough">>]>;
|
|
644
|
+
_meta: zod.ZodOptional<zod.ZodObject<{}, "passthrough", zod.ZodTypeAny, zod.objectOutputType<{}, zod.ZodTypeAny, "passthrough">, zod.objectInputType<{}, zod.ZodTypeAny, "passthrough">>>;
|
|
493
645
|
}, zod.ZodTypeAny, "passthrough">>]>;
|
|
494
646
|
}, "passthrough", zod.ZodTypeAny, zod.objectOutputType<{
|
|
495
647
|
role: zod.ZodEnum<["user", "assistant"]>;
|
|
496
648
|
content: zod.ZodUnion<[zod.ZodObject<{
|
|
497
649
|
type: zod.ZodLiteral<"text">;
|
|
498
650
|
text: zod.ZodString;
|
|
651
|
+
_meta: zod.ZodOptional<zod.ZodObject<{}, "passthrough", zod.ZodTypeAny, zod.objectOutputType<{}, zod.ZodTypeAny, "passthrough">, zod.objectInputType<{}, zod.ZodTypeAny, "passthrough">>>;
|
|
499
652
|
}, "passthrough", zod.ZodTypeAny, zod.objectOutputType<{
|
|
500
653
|
type: zod.ZodLiteral<"text">;
|
|
501
654
|
text: zod.ZodString;
|
|
655
|
+
_meta: zod.ZodOptional<zod.ZodObject<{}, "passthrough", zod.ZodTypeAny, zod.objectOutputType<{}, zod.ZodTypeAny, "passthrough">, zod.objectInputType<{}, zod.ZodTypeAny, "passthrough">>>;
|
|
502
656
|
}, zod.ZodTypeAny, "passthrough">, zod.objectInputType<{
|
|
503
657
|
type: zod.ZodLiteral<"text">;
|
|
504
658
|
text: zod.ZodString;
|
|
659
|
+
_meta: zod.ZodOptional<zod.ZodObject<{}, "passthrough", zod.ZodTypeAny, zod.objectOutputType<{}, zod.ZodTypeAny, "passthrough">, zod.objectInputType<{}, zod.ZodTypeAny, "passthrough">>>;
|
|
505
660
|
}, zod.ZodTypeAny, "passthrough">>, zod.ZodObject<{
|
|
506
661
|
type: zod.ZodLiteral<"image">;
|
|
507
662
|
data: zod.ZodString;
|
|
508
663
|
mimeType: zod.ZodString;
|
|
664
|
+
_meta: zod.ZodOptional<zod.ZodObject<{}, "passthrough", zod.ZodTypeAny, zod.objectOutputType<{}, zod.ZodTypeAny, "passthrough">, zod.objectInputType<{}, zod.ZodTypeAny, "passthrough">>>;
|
|
509
665
|
}, "passthrough", zod.ZodTypeAny, zod.objectOutputType<{
|
|
510
666
|
type: zod.ZodLiteral<"image">;
|
|
511
667
|
data: zod.ZodString;
|
|
512
668
|
mimeType: zod.ZodString;
|
|
669
|
+
_meta: zod.ZodOptional<zod.ZodObject<{}, "passthrough", zod.ZodTypeAny, zod.objectOutputType<{}, zod.ZodTypeAny, "passthrough">, zod.objectInputType<{}, zod.ZodTypeAny, "passthrough">>>;
|
|
513
670
|
}, zod.ZodTypeAny, "passthrough">, zod.objectInputType<{
|
|
514
671
|
type: zod.ZodLiteral<"image">;
|
|
515
672
|
data: zod.ZodString;
|
|
516
673
|
mimeType: zod.ZodString;
|
|
674
|
+
_meta: zod.ZodOptional<zod.ZodObject<{}, "passthrough", zod.ZodTypeAny, zod.objectOutputType<{}, zod.ZodTypeAny, "passthrough">, zod.objectInputType<{}, zod.ZodTypeAny, "passthrough">>>;
|
|
517
675
|
}, zod.ZodTypeAny, "passthrough">>, zod.ZodObject<{
|
|
518
676
|
type: zod.ZodLiteral<"audio">;
|
|
519
677
|
data: zod.ZodString;
|
|
520
678
|
mimeType: zod.ZodString;
|
|
679
|
+
_meta: zod.ZodOptional<zod.ZodObject<{}, "passthrough", zod.ZodTypeAny, zod.objectOutputType<{}, zod.ZodTypeAny, "passthrough">, zod.objectInputType<{}, zod.ZodTypeAny, "passthrough">>>;
|
|
521
680
|
}, "passthrough", zod.ZodTypeAny, zod.objectOutputType<{
|
|
522
681
|
type: zod.ZodLiteral<"audio">;
|
|
523
682
|
data: zod.ZodString;
|
|
524
683
|
mimeType: zod.ZodString;
|
|
684
|
+
_meta: zod.ZodOptional<zod.ZodObject<{}, "passthrough", zod.ZodTypeAny, zod.objectOutputType<{}, zod.ZodTypeAny, "passthrough">, zod.objectInputType<{}, zod.ZodTypeAny, "passthrough">>>;
|
|
525
685
|
}, zod.ZodTypeAny, "passthrough">, zod.objectInputType<{
|
|
526
686
|
type: zod.ZodLiteral<"audio">;
|
|
527
687
|
data: zod.ZodString;
|
|
528
688
|
mimeType: zod.ZodString;
|
|
529
|
-
|
|
689
|
+
_meta: zod.ZodOptional<zod.ZodObject<{}, "passthrough", zod.ZodTypeAny, zod.objectOutputType<{}, zod.ZodTypeAny, "passthrough">, zod.objectInputType<{}, zod.ZodTypeAny, "passthrough">>>;
|
|
690
|
+
}, zod.ZodTypeAny, "passthrough">>, zod.ZodObject<zod.objectUtil.extendShape<zod.objectUtil.extendShape<{
|
|
691
|
+
name: zod.ZodString;
|
|
692
|
+
title: zod.ZodOptional<zod.ZodString>;
|
|
693
|
+
}, {
|
|
694
|
+
uri: zod.ZodString;
|
|
695
|
+
description: zod.ZodOptional<zod.ZodString>;
|
|
696
|
+
mimeType: zod.ZodOptional<zod.ZodString>;
|
|
697
|
+
_meta: zod.ZodOptional<zod.ZodObject<{}, "passthrough", zod.ZodTypeAny, zod.objectOutputType<{}, zod.ZodTypeAny, "passthrough">, zod.objectInputType<{}, zod.ZodTypeAny, "passthrough">>>;
|
|
698
|
+
}>, {
|
|
699
|
+
type: zod.ZodLiteral<"resource_link">;
|
|
700
|
+
}>, "passthrough", zod.ZodTypeAny, zod.objectOutputType<zod.objectUtil.extendShape<zod.objectUtil.extendShape<{
|
|
701
|
+
name: zod.ZodString;
|
|
702
|
+
title: zod.ZodOptional<zod.ZodString>;
|
|
703
|
+
}, {
|
|
704
|
+
uri: zod.ZodString;
|
|
705
|
+
description: zod.ZodOptional<zod.ZodString>;
|
|
706
|
+
mimeType: zod.ZodOptional<zod.ZodString>;
|
|
707
|
+
_meta: zod.ZodOptional<zod.ZodObject<{}, "passthrough", zod.ZodTypeAny, zod.objectOutputType<{}, zod.ZodTypeAny, "passthrough">, zod.objectInputType<{}, zod.ZodTypeAny, "passthrough">>>;
|
|
708
|
+
}>, {
|
|
709
|
+
type: zod.ZodLiteral<"resource_link">;
|
|
710
|
+
}>, zod.ZodTypeAny, "passthrough">, zod.objectInputType<zod.objectUtil.extendShape<zod.objectUtil.extendShape<{
|
|
711
|
+
name: zod.ZodString;
|
|
712
|
+
title: zod.ZodOptional<zod.ZodString>;
|
|
713
|
+
}, {
|
|
714
|
+
uri: zod.ZodString;
|
|
715
|
+
description: zod.ZodOptional<zod.ZodString>;
|
|
716
|
+
mimeType: zod.ZodOptional<zod.ZodString>;
|
|
717
|
+
_meta: zod.ZodOptional<zod.ZodObject<{}, "passthrough", zod.ZodTypeAny, zod.objectOutputType<{}, zod.ZodTypeAny, "passthrough">, zod.objectInputType<{}, zod.ZodTypeAny, "passthrough">>>;
|
|
718
|
+
}>, {
|
|
719
|
+
type: zod.ZodLiteral<"resource_link">;
|
|
720
|
+
}>, zod.ZodTypeAny, "passthrough">>, zod.ZodObject<{
|
|
530
721
|
type: zod.ZodLiteral<"resource">;
|
|
531
722
|
resource: zod.ZodUnion<[zod.ZodObject<zod.objectUtil.extendShape<{
|
|
532
723
|
uri: zod.ZodString;
|
|
533
724
|
mimeType: zod.ZodOptional<zod.ZodString>;
|
|
725
|
+
_meta: zod.ZodOptional<zod.ZodObject<{}, "passthrough", zod.ZodTypeAny, zod.objectOutputType<{}, zod.ZodTypeAny, "passthrough">, zod.objectInputType<{}, zod.ZodTypeAny, "passthrough">>>;
|
|
534
726
|
}, {
|
|
535
727
|
text: zod.ZodString;
|
|
536
728
|
}>, "passthrough", zod.ZodTypeAny, zod.objectOutputType<zod.objectUtil.extendShape<{
|
|
537
729
|
uri: zod.ZodString;
|
|
538
730
|
mimeType: zod.ZodOptional<zod.ZodString>;
|
|
731
|
+
_meta: zod.ZodOptional<zod.ZodObject<{}, "passthrough", zod.ZodTypeAny, zod.objectOutputType<{}, zod.ZodTypeAny, "passthrough">, zod.objectInputType<{}, zod.ZodTypeAny, "passthrough">>>;
|
|
539
732
|
}, {
|
|
540
733
|
text: zod.ZodString;
|
|
541
734
|
}>, zod.ZodTypeAny, "passthrough">, zod.objectInputType<zod.objectUtil.extendShape<{
|
|
542
735
|
uri: zod.ZodString;
|
|
543
736
|
mimeType: zod.ZodOptional<zod.ZodString>;
|
|
737
|
+
_meta: zod.ZodOptional<zod.ZodObject<{}, "passthrough", zod.ZodTypeAny, zod.objectOutputType<{}, zod.ZodTypeAny, "passthrough">, zod.objectInputType<{}, zod.ZodTypeAny, "passthrough">>>;
|
|
544
738
|
}, {
|
|
545
739
|
text: zod.ZodString;
|
|
546
740
|
}>, zod.ZodTypeAny, "passthrough">>, zod.ZodObject<zod.objectUtil.extendShape<{
|
|
547
741
|
uri: zod.ZodString;
|
|
548
742
|
mimeType: zod.ZodOptional<zod.ZodString>;
|
|
743
|
+
_meta: zod.ZodOptional<zod.ZodObject<{}, "passthrough", zod.ZodTypeAny, zod.objectOutputType<{}, zod.ZodTypeAny, "passthrough">, zod.objectInputType<{}, zod.ZodTypeAny, "passthrough">>>;
|
|
549
744
|
}, {
|
|
550
745
|
blob: zod.ZodString;
|
|
551
746
|
}>, "passthrough", zod.ZodTypeAny, zod.objectOutputType<zod.objectUtil.extendShape<{
|
|
552
747
|
uri: zod.ZodString;
|
|
553
748
|
mimeType: zod.ZodOptional<zod.ZodString>;
|
|
749
|
+
_meta: zod.ZodOptional<zod.ZodObject<{}, "passthrough", zod.ZodTypeAny, zod.objectOutputType<{}, zod.ZodTypeAny, "passthrough">, zod.objectInputType<{}, zod.ZodTypeAny, "passthrough">>>;
|
|
554
750
|
}, {
|
|
555
751
|
blob: zod.ZodString;
|
|
556
752
|
}>, zod.ZodTypeAny, "passthrough">, zod.objectInputType<zod.objectUtil.extendShape<{
|
|
557
753
|
uri: zod.ZodString;
|
|
558
754
|
mimeType: zod.ZodOptional<zod.ZodString>;
|
|
755
|
+
_meta: zod.ZodOptional<zod.ZodObject<{}, "passthrough", zod.ZodTypeAny, zod.objectOutputType<{}, zod.ZodTypeAny, "passthrough">, zod.objectInputType<{}, zod.ZodTypeAny, "passthrough">>>;
|
|
559
756
|
}, {
|
|
560
757
|
blob: zod.ZodString;
|
|
561
758
|
}>, zod.ZodTypeAny, "passthrough">>]>;
|
|
759
|
+
_meta: zod.ZodOptional<zod.ZodObject<{}, "passthrough", zod.ZodTypeAny, zod.objectOutputType<{}, zod.ZodTypeAny, "passthrough">, zod.objectInputType<{}, zod.ZodTypeAny, "passthrough">>>;
|
|
562
760
|
}, "passthrough", zod.ZodTypeAny, zod.objectOutputType<{
|
|
563
761
|
type: zod.ZodLiteral<"resource">;
|
|
564
762
|
resource: zod.ZodUnion<[zod.ZodObject<zod.objectUtil.extendShape<{
|
|
565
763
|
uri: zod.ZodString;
|
|
566
764
|
mimeType: zod.ZodOptional<zod.ZodString>;
|
|
765
|
+
_meta: zod.ZodOptional<zod.ZodObject<{}, "passthrough", zod.ZodTypeAny, zod.objectOutputType<{}, zod.ZodTypeAny, "passthrough">, zod.objectInputType<{}, zod.ZodTypeAny, "passthrough">>>;
|
|
567
766
|
}, {
|
|
568
767
|
text: zod.ZodString;
|
|
569
768
|
}>, "passthrough", zod.ZodTypeAny, zod.objectOutputType<zod.objectUtil.extendShape<{
|
|
570
769
|
uri: zod.ZodString;
|
|
571
770
|
mimeType: zod.ZodOptional<zod.ZodString>;
|
|
771
|
+
_meta: zod.ZodOptional<zod.ZodObject<{}, "passthrough", zod.ZodTypeAny, zod.objectOutputType<{}, zod.ZodTypeAny, "passthrough">, zod.objectInputType<{}, zod.ZodTypeAny, "passthrough">>>;
|
|
572
772
|
}, {
|
|
573
773
|
text: zod.ZodString;
|
|
574
774
|
}>, zod.ZodTypeAny, "passthrough">, zod.objectInputType<zod.objectUtil.extendShape<{
|
|
575
775
|
uri: zod.ZodString;
|
|
576
776
|
mimeType: zod.ZodOptional<zod.ZodString>;
|
|
777
|
+
_meta: zod.ZodOptional<zod.ZodObject<{}, "passthrough", zod.ZodTypeAny, zod.objectOutputType<{}, zod.ZodTypeAny, "passthrough">, zod.objectInputType<{}, zod.ZodTypeAny, "passthrough">>>;
|
|
577
778
|
}, {
|
|
578
779
|
text: zod.ZodString;
|
|
579
780
|
}>, zod.ZodTypeAny, "passthrough">>, zod.ZodObject<zod.objectUtil.extendShape<{
|
|
580
781
|
uri: zod.ZodString;
|
|
581
782
|
mimeType: zod.ZodOptional<zod.ZodString>;
|
|
783
|
+
_meta: zod.ZodOptional<zod.ZodObject<{}, "passthrough", zod.ZodTypeAny, zod.objectOutputType<{}, zod.ZodTypeAny, "passthrough">, zod.objectInputType<{}, zod.ZodTypeAny, "passthrough">>>;
|
|
582
784
|
}, {
|
|
583
785
|
blob: zod.ZodString;
|
|
584
786
|
}>, "passthrough", zod.ZodTypeAny, zod.objectOutputType<zod.objectUtil.extendShape<{
|
|
585
787
|
uri: zod.ZodString;
|
|
586
788
|
mimeType: zod.ZodOptional<zod.ZodString>;
|
|
789
|
+
_meta: zod.ZodOptional<zod.ZodObject<{}, "passthrough", zod.ZodTypeAny, zod.objectOutputType<{}, zod.ZodTypeAny, "passthrough">, zod.objectInputType<{}, zod.ZodTypeAny, "passthrough">>>;
|
|
587
790
|
}, {
|
|
588
791
|
blob: zod.ZodString;
|
|
589
792
|
}>, zod.ZodTypeAny, "passthrough">, zod.objectInputType<zod.objectUtil.extendShape<{
|
|
590
793
|
uri: zod.ZodString;
|
|
591
794
|
mimeType: zod.ZodOptional<zod.ZodString>;
|
|
795
|
+
_meta: zod.ZodOptional<zod.ZodObject<{}, "passthrough", zod.ZodTypeAny, zod.objectOutputType<{}, zod.ZodTypeAny, "passthrough">, zod.objectInputType<{}, zod.ZodTypeAny, "passthrough">>>;
|
|
592
796
|
}, {
|
|
593
797
|
blob: zod.ZodString;
|
|
594
798
|
}>, zod.ZodTypeAny, "passthrough">>]>;
|
|
799
|
+
_meta: zod.ZodOptional<zod.ZodObject<{}, "passthrough", zod.ZodTypeAny, zod.objectOutputType<{}, zod.ZodTypeAny, "passthrough">, zod.objectInputType<{}, zod.ZodTypeAny, "passthrough">>>;
|
|
595
800
|
}, zod.ZodTypeAny, "passthrough">, zod.objectInputType<{
|
|
596
801
|
type: zod.ZodLiteral<"resource">;
|
|
597
802
|
resource: zod.ZodUnion<[zod.ZodObject<zod.objectUtil.extendShape<{
|
|
598
803
|
uri: zod.ZodString;
|
|
599
804
|
mimeType: zod.ZodOptional<zod.ZodString>;
|
|
805
|
+
_meta: zod.ZodOptional<zod.ZodObject<{}, "passthrough", zod.ZodTypeAny, zod.objectOutputType<{}, zod.ZodTypeAny, "passthrough">, zod.objectInputType<{}, zod.ZodTypeAny, "passthrough">>>;
|
|
600
806
|
}, {
|
|
601
807
|
text: zod.ZodString;
|
|
602
808
|
}>, "passthrough", zod.ZodTypeAny, zod.objectOutputType<zod.objectUtil.extendShape<{
|
|
603
809
|
uri: zod.ZodString;
|
|
604
810
|
mimeType: zod.ZodOptional<zod.ZodString>;
|
|
811
|
+
_meta: zod.ZodOptional<zod.ZodObject<{}, "passthrough", zod.ZodTypeAny, zod.objectOutputType<{}, zod.ZodTypeAny, "passthrough">, zod.objectInputType<{}, zod.ZodTypeAny, "passthrough">>>;
|
|
605
812
|
}, {
|
|
606
813
|
text: zod.ZodString;
|
|
607
814
|
}>, zod.ZodTypeAny, "passthrough">, zod.objectInputType<zod.objectUtil.extendShape<{
|
|
608
815
|
uri: zod.ZodString;
|
|
609
816
|
mimeType: zod.ZodOptional<zod.ZodString>;
|
|
817
|
+
_meta: zod.ZodOptional<zod.ZodObject<{}, "passthrough", zod.ZodTypeAny, zod.objectOutputType<{}, zod.ZodTypeAny, "passthrough">, zod.objectInputType<{}, zod.ZodTypeAny, "passthrough">>>;
|
|
610
818
|
}, {
|
|
611
819
|
text: zod.ZodString;
|
|
612
820
|
}>, zod.ZodTypeAny, "passthrough">>, zod.ZodObject<zod.objectUtil.extendShape<{
|
|
613
821
|
uri: zod.ZodString;
|
|
614
822
|
mimeType: zod.ZodOptional<zod.ZodString>;
|
|
823
|
+
_meta: zod.ZodOptional<zod.ZodObject<{}, "passthrough", zod.ZodTypeAny, zod.objectOutputType<{}, zod.ZodTypeAny, "passthrough">, zod.objectInputType<{}, zod.ZodTypeAny, "passthrough">>>;
|
|
615
824
|
}, {
|
|
616
825
|
blob: zod.ZodString;
|
|
617
826
|
}>, "passthrough", zod.ZodTypeAny, zod.objectOutputType<zod.objectUtil.extendShape<{
|
|
618
827
|
uri: zod.ZodString;
|
|
619
828
|
mimeType: zod.ZodOptional<zod.ZodString>;
|
|
829
|
+
_meta: zod.ZodOptional<zod.ZodObject<{}, "passthrough", zod.ZodTypeAny, zod.objectOutputType<{}, zod.ZodTypeAny, "passthrough">, zod.objectInputType<{}, zod.ZodTypeAny, "passthrough">>>;
|
|
620
830
|
}, {
|
|
621
831
|
blob: zod.ZodString;
|
|
622
832
|
}>, zod.ZodTypeAny, "passthrough">, zod.objectInputType<zod.objectUtil.extendShape<{
|
|
623
833
|
uri: zod.ZodString;
|
|
624
834
|
mimeType: zod.ZodOptional<zod.ZodString>;
|
|
835
|
+
_meta: zod.ZodOptional<zod.ZodObject<{}, "passthrough", zod.ZodTypeAny, zod.objectOutputType<{}, zod.ZodTypeAny, "passthrough">, zod.objectInputType<{}, zod.ZodTypeAny, "passthrough">>>;
|
|
625
836
|
}, {
|
|
626
837
|
blob: zod.ZodString;
|
|
627
838
|
}>, zod.ZodTypeAny, "passthrough">>]>;
|
|
839
|
+
_meta: zod.ZodOptional<zod.ZodObject<{}, "passthrough", zod.ZodTypeAny, zod.objectOutputType<{}, zod.ZodTypeAny, "passthrough">, zod.objectInputType<{}, zod.ZodTypeAny, "passthrough">>>;
|
|
628
840
|
}, zod.ZodTypeAny, "passthrough">>]>;
|
|
629
841
|
}, zod.ZodTypeAny, "passthrough">, zod.objectInputType<{
|
|
630
842
|
role: zod.ZodEnum<["user", "assistant"]>;
|
|
631
843
|
content: zod.ZodUnion<[zod.ZodObject<{
|
|
632
844
|
type: zod.ZodLiteral<"text">;
|
|
633
845
|
text: zod.ZodString;
|
|
846
|
+
_meta: zod.ZodOptional<zod.ZodObject<{}, "passthrough", zod.ZodTypeAny, zod.objectOutputType<{}, zod.ZodTypeAny, "passthrough">, zod.objectInputType<{}, zod.ZodTypeAny, "passthrough">>>;
|
|
634
847
|
}, "passthrough", zod.ZodTypeAny, zod.objectOutputType<{
|
|
635
848
|
type: zod.ZodLiteral<"text">;
|
|
636
849
|
text: zod.ZodString;
|
|
850
|
+
_meta: zod.ZodOptional<zod.ZodObject<{}, "passthrough", zod.ZodTypeAny, zod.objectOutputType<{}, zod.ZodTypeAny, "passthrough">, zod.objectInputType<{}, zod.ZodTypeAny, "passthrough">>>;
|
|
637
851
|
}, zod.ZodTypeAny, "passthrough">, zod.objectInputType<{
|
|
638
852
|
type: zod.ZodLiteral<"text">;
|
|
639
853
|
text: zod.ZodString;
|
|
854
|
+
_meta: zod.ZodOptional<zod.ZodObject<{}, "passthrough", zod.ZodTypeAny, zod.objectOutputType<{}, zod.ZodTypeAny, "passthrough">, zod.objectInputType<{}, zod.ZodTypeAny, "passthrough">>>;
|
|
640
855
|
}, zod.ZodTypeAny, "passthrough">>, zod.ZodObject<{
|
|
641
856
|
type: zod.ZodLiteral<"image">;
|
|
642
857
|
data: zod.ZodString;
|
|
643
858
|
mimeType: zod.ZodString;
|
|
859
|
+
_meta: zod.ZodOptional<zod.ZodObject<{}, "passthrough", zod.ZodTypeAny, zod.objectOutputType<{}, zod.ZodTypeAny, "passthrough">, zod.objectInputType<{}, zod.ZodTypeAny, "passthrough">>>;
|
|
644
860
|
}, "passthrough", zod.ZodTypeAny, zod.objectOutputType<{
|
|
645
861
|
type: zod.ZodLiteral<"image">;
|
|
646
862
|
data: zod.ZodString;
|
|
647
863
|
mimeType: zod.ZodString;
|
|
864
|
+
_meta: zod.ZodOptional<zod.ZodObject<{}, "passthrough", zod.ZodTypeAny, zod.objectOutputType<{}, zod.ZodTypeAny, "passthrough">, zod.objectInputType<{}, zod.ZodTypeAny, "passthrough">>>;
|
|
648
865
|
}, zod.ZodTypeAny, "passthrough">, zod.objectInputType<{
|
|
649
866
|
type: zod.ZodLiteral<"image">;
|
|
650
867
|
data: zod.ZodString;
|
|
651
868
|
mimeType: zod.ZodString;
|
|
869
|
+
_meta: zod.ZodOptional<zod.ZodObject<{}, "passthrough", zod.ZodTypeAny, zod.objectOutputType<{}, zod.ZodTypeAny, "passthrough">, zod.objectInputType<{}, zod.ZodTypeAny, "passthrough">>>;
|
|
652
870
|
}, zod.ZodTypeAny, "passthrough">>, zod.ZodObject<{
|
|
653
871
|
type: zod.ZodLiteral<"audio">;
|
|
654
872
|
data: zod.ZodString;
|
|
655
873
|
mimeType: zod.ZodString;
|
|
874
|
+
_meta: zod.ZodOptional<zod.ZodObject<{}, "passthrough", zod.ZodTypeAny, zod.objectOutputType<{}, zod.ZodTypeAny, "passthrough">, zod.objectInputType<{}, zod.ZodTypeAny, "passthrough">>>;
|
|
656
875
|
}, "passthrough", zod.ZodTypeAny, zod.objectOutputType<{
|
|
657
876
|
type: zod.ZodLiteral<"audio">;
|
|
658
877
|
data: zod.ZodString;
|
|
659
878
|
mimeType: zod.ZodString;
|
|
879
|
+
_meta: zod.ZodOptional<zod.ZodObject<{}, "passthrough", zod.ZodTypeAny, zod.objectOutputType<{}, zod.ZodTypeAny, "passthrough">, zod.objectInputType<{}, zod.ZodTypeAny, "passthrough">>>;
|
|
660
880
|
}, zod.ZodTypeAny, "passthrough">, zod.objectInputType<{
|
|
661
881
|
type: zod.ZodLiteral<"audio">;
|
|
662
882
|
data: zod.ZodString;
|
|
663
883
|
mimeType: zod.ZodString;
|
|
664
|
-
|
|
884
|
+
_meta: zod.ZodOptional<zod.ZodObject<{}, "passthrough", zod.ZodTypeAny, zod.objectOutputType<{}, zod.ZodTypeAny, "passthrough">, zod.objectInputType<{}, zod.ZodTypeAny, "passthrough">>>;
|
|
885
|
+
}, zod.ZodTypeAny, "passthrough">>, zod.ZodObject<zod.objectUtil.extendShape<zod.objectUtil.extendShape<{
|
|
886
|
+
name: zod.ZodString;
|
|
887
|
+
title: zod.ZodOptional<zod.ZodString>;
|
|
888
|
+
}, {
|
|
889
|
+
uri: zod.ZodString;
|
|
890
|
+
description: zod.ZodOptional<zod.ZodString>;
|
|
891
|
+
mimeType: zod.ZodOptional<zod.ZodString>;
|
|
892
|
+
_meta: zod.ZodOptional<zod.ZodObject<{}, "passthrough", zod.ZodTypeAny, zod.objectOutputType<{}, zod.ZodTypeAny, "passthrough">, zod.objectInputType<{}, zod.ZodTypeAny, "passthrough">>>;
|
|
893
|
+
}>, {
|
|
894
|
+
type: zod.ZodLiteral<"resource_link">;
|
|
895
|
+
}>, "passthrough", zod.ZodTypeAny, zod.objectOutputType<zod.objectUtil.extendShape<zod.objectUtil.extendShape<{
|
|
896
|
+
name: zod.ZodString;
|
|
897
|
+
title: zod.ZodOptional<zod.ZodString>;
|
|
898
|
+
}, {
|
|
899
|
+
uri: zod.ZodString;
|
|
900
|
+
description: zod.ZodOptional<zod.ZodString>;
|
|
901
|
+
mimeType: zod.ZodOptional<zod.ZodString>;
|
|
902
|
+
_meta: zod.ZodOptional<zod.ZodObject<{}, "passthrough", zod.ZodTypeAny, zod.objectOutputType<{}, zod.ZodTypeAny, "passthrough">, zod.objectInputType<{}, zod.ZodTypeAny, "passthrough">>>;
|
|
903
|
+
}>, {
|
|
904
|
+
type: zod.ZodLiteral<"resource_link">;
|
|
905
|
+
}>, zod.ZodTypeAny, "passthrough">, zod.objectInputType<zod.objectUtil.extendShape<zod.objectUtil.extendShape<{
|
|
906
|
+
name: zod.ZodString;
|
|
907
|
+
title: zod.ZodOptional<zod.ZodString>;
|
|
908
|
+
}, {
|
|
909
|
+
uri: zod.ZodString;
|
|
910
|
+
description: zod.ZodOptional<zod.ZodString>;
|
|
911
|
+
mimeType: zod.ZodOptional<zod.ZodString>;
|
|
912
|
+
_meta: zod.ZodOptional<zod.ZodObject<{}, "passthrough", zod.ZodTypeAny, zod.objectOutputType<{}, zod.ZodTypeAny, "passthrough">, zod.objectInputType<{}, zod.ZodTypeAny, "passthrough">>>;
|
|
913
|
+
}>, {
|
|
914
|
+
type: zod.ZodLiteral<"resource_link">;
|
|
915
|
+
}>, zod.ZodTypeAny, "passthrough">>, zod.ZodObject<{
|
|
665
916
|
type: zod.ZodLiteral<"resource">;
|
|
666
917
|
resource: zod.ZodUnion<[zod.ZodObject<zod.objectUtil.extendShape<{
|
|
667
918
|
uri: zod.ZodString;
|
|
668
919
|
mimeType: zod.ZodOptional<zod.ZodString>;
|
|
920
|
+
_meta: zod.ZodOptional<zod.ZodObject<{}, "passthrough", zod.ZodTypeAny, zod.objectOutputType<{}, zod.ZodTypeAny, "passthrough">, zod.objectInputType<{}, zod.ZodTypeAny, "passthrough">>>;
|
|
669
921
|
}, {
|
|
670
922
|
text: zod.ZodString;
|
|
671
923
|
}>, "passthrough", zod.ZodTypeAny, zod.objectOutputType<zod.objectUtil.extendShape<{
|
|
672
924
|
uri: zod.ZodString;
|
|
673
925
|
mimeType: zod.ZodOptional<zod.ZodString>;
|
|
926
|
+
_meta: zod.ZodOptional<zod.ZodObject<{}, "passthrough", zod.ZodTypeAny, zod.objectOutputType<{}, zod.ZodTypeAny, "passthrough">, zod.objectInputType<{}, zod.ZodTypeAny, "passthrough">>>;
|
|
674
927
|
}, {
|
|
675
928
|
text: zod.ZodString;
|
|
676
929
|
}>, zod.ZodTypeAny, "passthrough">, zod.objectInputType<zod.objectUtil.extendShape<{
|
|
677
930
|
uri: zod.ZodString;
|
|
678
931
|
mimeType: zod.ZodOptional<zod.ZodString>;
|
|
932
|
+
_meta: zod.ZodOptional<zod.ZodObject<{}, "passthrough", zod.ZodTypeAny, zod.objectOutputType<{}, zod.ZodTypeAny, "passthrough">, zod.objectInputType<{}, zod.ZodTypeAny, "passthrough">>>;
|
|
679
933
|
}, {
|
|
680
934
|
text: zod.ZodString;
|
|
681
935
|
}>, zod.ZodTypeAny, "passthrough">>, zod.ZodObject<zod.objectUtil.extendShape<{
|
|
682
936
|
uri: zod.ZodString;
|
|
683
937
|
mimeType: zod.ZodOptional<zod.ZodString>;
|
|
938
|
+
_meta: zod.ZodOptional<zod.ZodObject<{}, "passthrough", zod.ZodTypeAny, zod.objectOutputType<{}, zod.ZodTypeAny, "passthrough">, zod.objectInputType<{}, zod.ZodTypeAny, "passthrough">>>;
|
|
684
939
|
}, {
|
|
685
940
|
blob: zod.ZodString;
|
|
686
941
|
}>, "passthrough", zod.ZodTypeAny, zod.objectOutputType<zod.objectUtil.extendShape<{
|
|
687
942
|
uri: zod.ZodString;
|
|
688
943
|
mimeType: zod.ZodOptional<zod.ZodString>;
|
|
944
|
+
_meta: zod.ZodOptional<zod.ZodObject<{}, "passthrough", zod.ZodTypeAny, zod.objectOutputType<{}, zod.ZodTypeAny, "passthrough">, zod.objectInputType<{}, zod.ZodTypeAny, "passthrough">>>;
|
|
689
945
|
}, {
|
|
690
946
|
blob: zod.ZodString;
|
|
691
947
|
}>, zod.ZodTypeAny, "passthrough">, zod.objectInputType<zod.objectUtil.extendShape<{
|
|
692
948
|
uri: zod.ZodString;
|
|
693
949
|
mimeType: zod.ZodOptional<zod.ZodString>;
|
|
950
|
+
_meta: zod.ZodOptional<zod.ZodObject<{}, "passthrough", zod.ZodTypeAny, zod.objectOutputType<{}, zod.ZodTypeAny, "passthrough">, zod.objectInputType<{}, zod.ZodTypeAny, "passthrough">>>;
|
|
694
951
|
}, {
|
|
695
952
|
blob: zod.ZodString;
|
|
696
953
|
}>, zod.ZodTypeAny, "passthrough">>]>;
|
|
954
|
+
_meta: zod.ZodOptional<zod.ZodObject<{}, "passthrough", zod.ZodTypeAny, zod.objectOutputType<{}, zod.ZodTypeAny, "passthrough">, zod.objectInputType<{}, zod.ZodTypeAny, "passthrough">>>;
|
|
697
955
|
}, "passthrough", zod.ZodTypeAny, zod.objectOutputType<{
|
|
698
956
|
type: zod.ZodLiteral<"resource">;
|
|
699
957
|
resource: zod.ZodUnion<[zod.ZodObject<zod.objectUtil.extendShape<{
|
|
700
958
|
uri: zod.ZodString;
|
|
701
959
|
mimeType: zod.ZodOptional<zod.ZodString>;
|
|
960
|
+
_meta: zod.ZodOptional<zod.ZodObject<{}, "passthrough", zod.ZodTypeAny, zod.objectOutputType<{}, zod.ZodTypeAny, "passthrough">, zod.objectInputType<{}, zod.ZodTypeAny, "passthrough">>>;
|
|
702
961
|
}, {
|
|
703
962
|
text: zod.ZodString;
|
|
704
963
|
}>, "passthrough", zod.ZodTypeAny, zod.objectOutputType<zod.objectUtil.extendShape<{
|
|
705
964
|
uri: zod.ZodString;
|
|
706
965
|
mimeType: zod.ZodOptional<zod.ZodString>;
|
|
966
|
+
_meta: zod.ZodOptional<zod.ZodObject<{}, "passthrough", zod.ZodTypeAny, zod.objectOutputType<{}, zod.ZodTypeAny, "passthrough">, zod.objectInputType<{}, zod.ZodTypeAny, "passthrough">>>;
|
|
707
967
|
}, {
|
|
708
968
|
text: zod.ZodString;
|
|
709
969
|
}>, zod.ZodTypeAny, "passthrough">, zod.objectInputType<zod.objectUtil.extendShape<{
|
|
710
970
|
uri: zod.ZodString;
|
|
711
971
|
mimeType: zod.ZodOptional<zod.ZodString>;
|
|
972
|
+
_meta: zod.ZodOptional<zod.ZodObject<{}, "passthrough", zod.ZodTypeAny, zod.objectOutputType<{}, zod.ZodTypeAny, "passthrough">, zod.objectInputType<{}, zod.ZodTypeAny, "passthrough">>>;
|
|
712
973
|
}, {
|
|
713
974
|
text: zod.ZodString;
|
|
714
975
|
}>, zod.ZodTypeAny, "passthrough">>, zod.ZodObject<zod.objectUtil.extendShape<{
|
|
715
976
|
uri: zod.ZodString;
|
|
716
977
|
mimeType: zod.ZodOptional<zod.ZodString>;
|
|
978
|
+
_meta: zod.ZodOptional<zod.ZodObject<{}, "passthrough", zod.ZodTypeAny, zod.objectOutputType<{}, zod.ZodTypeAny, "passthrough">, zod.objectInputType<{}, zod.ZodTypeAny, "passthrough">>>;
|
|
717
979
|
}, {
|
|
718
980
|
blob: zod.ZodString;
|
|
719
981
|
}>, "passthrough", zod.ZodTypeAny, zod.objectOutputType<zod.objectUtil.extendShape<{
|
|
720
982
|
uri: zod.ZodString;
|
|
721
983
|
mimeType: zod.ZodOptional<zod.ZodString>;
|
|
984
|
+
_meta: zod.ZodOptional<zod.ZodObject<{}, "passthrough", zod.ZodTypeAny, zod.objectOutputType<{}, zod.ZodTypeAny, "passthrough">, zod.objectInputType<{}, zod.ZodTypeAny, "passthrough">>>;
|
|
722
985
|
}, {
|
|
723
986
|
blob: zod.ZodString;
|
|
724
987
|
}>, zod.ZodTypeAny, "passthrough">, zod.objectInputType<zod.objectUtil.extendShape<{
|
|
725
988
|
uri: zod.ZodString;
|
|
726
989
|
mimeType: zod.ZodOptional<zod.ZodString>;
|
|
990
|
+
_meta: zod.ZodOptional<zod.ZodObject<{}, "passthrough", zod.ZodTypeAny, zod.objectOutputType<{}, zod.ZodTypeAny, "passthrough">, zod.objectInputType<{}, zod.ZodTypeAny, "passthrough">>>;
|
|
727
991
|
}, {
|
|
728
992
|
blob: zod.ZodString;
|
|
729
993
|
}>, zod.ZodTypeAny, "passthrough">>]>;
|
|
994
|
+
_meta: zod.ZodOptional<zod.ZodObject<{}, "passthrough", zod.ZodTypeAny, zod.objectOutputType<{}, zod.ZodTypeAny, "passthrough">, zod.objectInputType<{}, zod.ZodTypeAny, "passthrough">>>;
|
|
730
995
|
}, zod.ZodTypeAny, "passthrough">, zod.objectInputType<{
|
|
731
996
|
type: zod.ZodLiteral<"resource">;
|
|
732
997
|
resource: zod.ZodUnion<[zod.ZodObject<zod.objectUtil.extendShape<{
|
|
733
998
|
uri: zod.ZodString;
|
|
734
999
|
mimeType: zod.ZodOptional<zod.ZodString>;
|
|
1000
|
+
_meta: zod.ZodOptional<zod.ZodObject<{}, "passthrough", zod.ZodTypeAny, zod.objectOutputType<{}, zod.ZodTypeAny, "passthrough">, zod.objectInputType<{}, zod.ZodTypeAny, "passthrough">>>;
|
|
735
1001
|
}, {
|
|
736
1002
|
text: zod.ZodString;
|
|
737
1003
|
}>, "passthrough", zod.ZodTypeAny, zod.objectOutputType<zod.objectUtil.extendShape<{
|
|
738
1004
|
uri: zod.ZodString;
|
|
739
1005
|
mimeType: zod.ZodOptional<zod.ZodString>;
|
|
1006
|
+
_meta: zod.ZodOptional<zod.ZodObject<{}, "passthrough", zod.ZodTypeAny, zod.objectOutputType<{}, zod.ZodTypeAny, "passthrough">, zod.objectInputType<{}, zod.ZodTypeAny, "passthrough">>>;
|
|
740
1007
|
}, {
|
|
741
1008
|
text: zod.ZodString;
|
|
742
1009
|
}>, zod.ZodTypeAny, "passthrough">, zod.objectInputType<zod.objectUtil.extendShape<{
|
|
743
1010
|
uri: zod.ZodString;
|
|
744
1011
|
mimeType: zod.ZodOptional<zod.ZodString>;
|
|
1012
|
+
_meta: zod.ZodOptional<zod.ZodObject<{}, "passthrough", zod.ZodTypeAny, zod.objectOutputType<{}, zod.ZodTypeAny, "passthrough">, zod.objectInputType<{}, zod.ZodTypeAny, "passthrough">>>;
|
|
745
1013
|
}, {
|
|
746
1014
|
text: zod.ZodString;
|
|
747
1015
|
}>, zod.ZodTypeAny, "passthrough">>, zod.ZodObject<zod.objectUtil.extendShape<{
|
|
748
1016
|
uri: zod.ZodString;
|
|
749
1017
|
mimeType: zod.ZodOptional<zod.ZodString>;
|
|
1018
|
+
_meta: zod.ZodOptional<zod.ZodObject<{}, "passthrough", zod.ZodTypeAny, zod.objectOutputType<{}, zod.ZodTypeAny, "passthrough">, zod.objectInputType<{}, zod.ZodTypeAny, "passthrough">>>;
|
|
750
1019
|
}, {
|
|
751
1020
|
blob: zod.ZodString;
|
|
752
1021
|
}>, "passthrough", zod.ZodTypeAny, zod.objectOutputType<zod.objectUtil.extendShape<{
|
|
753
1022
|
uri: zod.ZodString;
|
|
754
1023
|
mimeType: zod.ZodOptional<zod.ZodString>;
|
|
1024
|
+
_meta: zod.ZodOptional<zod.ZodObject<{}, "passthrough", zod.ZodTypeAny, zod.objectOutputType<{}, zod.ZodTypeAny, "passthrough">, zod.objectInputType<{}, zod.ZodTypeAny, "passthrough">>>;
|
|
755
1025
|
}, {
|
|
756
1026
|
blob: zod.ZodString;
|
|
757
1027
|
}>, zod.ZodTypeAny, "passthrough">, zod.objectInputType<zod.objectUtil.extendShape<{
|
|
758
1028
|
uri: zod.ZodString;
|
|
759
1029
|
mimeType: zod.ZodOptional<zod.ZodString>;
|
|
1030
|
+
_meta: zod.ZodOptional<zod.ZodObject<{}, "passthrough", zod.ZodTypeAny, zod.objectOutputType<{}, zod.ZodTypeAny, "passthrough">, zod.objectInputType<{}, zod.ZodTypeAny, "passthrough">>>;
|
|
760
1031
|
}, {
|
|
761
1032
|
blob: zod.ZodString;
|
|
762
1033
|
}>, zod.ZodTypeAny, "passthrough">>]>;
|
|
1034
|
+
_meta: zod.ZodOptional<zod.ZodObject<{}, "passthrough", zod.ZodTypeAny, zod.objectOutputType<{}, zod.ZodTypeAny, "passthrough">, zod.objectInputType<{}, zod.ZodTypeAny, "passthrough">>>;
|
|
763
1035
|
}, zod.ZodTypeAny, "passthrough">>]>;
|
|
764
1036
|
}, zod.ZodTypeAny, "passthrough">>, "many">;
|
|
765
1037
|
}, zod.ZodTypeAny, "passthrough">>;
|
package/dist/mcp/index.js
CHANGED
package/package.json
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
"url": "https://github.com/cloudflare/agents/issues"
|
|
5
5
|
},
|
|
6
6
|
"dependencies": {
|
|
7
|
-
"@modelcontextprotocol/sdk": "^1.13.
|
|
7
|
+
"@modelcontextprotocol/sdk": "^1.13.3",
|
|
8
8
|
"ai": "^4.3.16",
|
|
9
9
|
"cron-schedule": "^5.0.4",
|
|
10
10
|
"nanoid": "^5.1.5",
|
|
@@ -14,7 +14,6 @@
|
|
|
14
14
|
},
|
|
15
15
|
"description": "A home for your AI agents",
|
|
16
16
|
"devDependencies": {
|
|
17
|
-
"@cloudflare/vitest-pool-workers": "^0.8.46",
|
|
18
17
|
"react": "*",
|
|
19
18
|
"vitest-browser-react": "^1.0.0"
|
|
20
19
|
},
|
|
@@ -97,5 +96,5 @@
|
|
|
97
96
|
},
|
|
98
97
|
"type": "module",
|
|
99
98
|
"types": "dist/index.d.ts",
|
|
100
|
-
"version": "0.0.
|
|
99
|
+
"version": "0.0.101"
|
|
101
100
|
}
|
package/src/index.ts
CHANGED
|
@@ -546,8 +546,8 @@ export class Agent<Env, State = unknown> extends Server<Env> {
|
|
|
546
546
|
).then((_results) => {
|
|
547
547
|
this.broadcast(
|
|
548
548
|
JSON.stringify({
|
|
549
|
-
type: "cf_agent_mcp_servers",
|
|
550
549
|
mcp: this.getMcpServers(),
|
|
550
|
+
type: "cf_agent_mcp_servers",
|
|
551
551
|
})
|
|
552
552
|
);
|
|
553
553
|
});
|