nicely refactored mcp add done

This commit is contained in:
Dustin Healy 2025-06-27 11:53:42 -07:00
parent 234827dc57
commit 568ec2f7d5
5 changed files with 22 additions and 240 deletions

View file

@ -833,54 +833,11 @@ export const createMemory = (data: {
return request.post(endpoints.memories(), data);
};
export const createTool = (toolData: {
name: string;
description: string;
metadata?: Record<string, unknown>;
// MCP-specific fields
url?: string;
icon?: string;
tools?: string[];
trust?: boolean;
customHeaders?: Array<{
id: string;
name: string;
value: string;
}>;
requestTimeout?: number;
connectionTimeout?: number;
}): Promise<{
id?: string;
mcp_id?: string;
type?: string;
function?: {
name: string;
description: string;
};
metadata:
| Record<string, unknown>
| {
name: string;
description: string;
url?: string;
icon?: string;
tools?: string[];
trust?: boolean;
customHeaders?: Array<{
id: string;
name: string;
value: string;
}>;
requestTimeout?: number;
connectionTimeout?: number;
};
created_at: string;
updated_at: string;
}> => {
export const createMCP = (mcp: ag.MCP): Promise<Record<string, unknown>> => {
return request.post(
endpoints.agents({
path: 'tools/add',
}),
toolData,
mcp,
);
};

View file

@ -12,7 +12,7 @@ import {
AgentCreateParams,
AgentUpdateParams,
} from './assistants';
import { Action, ActionMetadata } from './agents';
import { Action, ActionMetadata, MCP } from './agents';
export type MutationOptions<
Response,
@ -319,6 +319,8 @@ export type AcceptTermsMutationOptions = MutationOptions<
/* Tools */
export type UpdatePluginAuthOptions = MutationOptions<types.TUser, types.TUpdateUserPlugins>;
export type CreateMCPMutationOptions = MutationOptions<Record<string, unknown>, MCP>;
export type ToolParamsMap = {
[Tools.execute_code]: {
lang: string;