mirror of
https://github.com/danny-avila/LibreChat.git
synced 2026-02-11 20:14:24 +01:00
nicely refactored mcp add done
This commit is contained in:
parent
234827dc57
commit
568ec2f7d5
5 changed files with 22 additions and 240 deletions
|
|
@ -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,
|
||||
);
|
||||
};
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue