Subir archivos a "/"
This commit is contained in:
78
webmcp.d.ts
vendored
Normal file
78
webmcp.d.ts
vendored
Normal file
@@ -0,0 +1,78 @@
|
||||
export interface WebMCPOptions {
|
||||
color?: string;
|
||||
position?: 'bottom-right' | 'bottom-left' | 'top-right' | 'top-left';
|
||||
size?: string;
|
||||
padding?: string;
|
||||
inactivityTimeout?: number;
|
||||
headless?: boolean;
|
||||
}
|
||||
|
||||
export interface ToolInputSchema {
|
||||
type: string;
|
||||
properties: Record<string, any>;
|
||||
required?: string[];
|
||||
}
|
||||
|
||||
export interface ResourceOptions {
|
||||
uri?: string;
|
||||
uriTemplate?: string;
|
||||
mimeType?: string;
|
||||
}
|
||||
|
||||
export interface PromptArgument {
|
||||
name: string;
|
||||
description?: string;
|
||||
required?: boolean;
|
||||
}
|
||||
|
||||
export type ToolHandler = (args: any) => string | object | Promise<string | object>;
|
||||
export type PromptHandler = (args: any) => object | Promise<object>;
|
||||
export type ResourceHandler = (uri: string) => object | Promise<object>;
|
||||
|
||||
export interface ConnectionInfo {
|
||||
isConnected: boolean;
|
||||
channel: string;
|
||||
server: string;
|
||||
status: string;
|
||||
tools: string[];
|
||||
prompts: string[];
|
||||
resources: string[];
|
||||
}
|
||||
|
||||
export interface WebMCPEventMap {
|
||||
connected: { channel: string; server: string };
|
||||
disconnected: { code: number; reason: string };
|
||||
reconnecting: { attempt: number; maxAttempts: number; delay: number };
|
||||
statusChange: { status: string; message: string };
|
||||
toolRegistered: { name: string };
|
||||
toolCreated: { name: string };
|
||||
toolRemoved: { name: string };
|
||||
error: { message: string };
|
||||
}
|
||||
|
||||
declare class WebMCP {
|
||||
readonly isConnected: boolean;
|
||||
readonly isExpanded: boolean;
|
||||
|
||||
constructor(options?: WebMCPOptions);
|
||||
|
||||
connect(connectionToken: string): Promise<void>;
|
||||
disconnect(): void;
|
||||
|
||||
on<K extends keyof WebMCPEventMap>(event: K, callback: (data: WebMCPEventMap[K]) => void): () => void;
|
||||
off<K extends keyof WebMCPEventMap>(event: K, callback: (data: WebMCPEventMap[K]) => void): void;
|
||||
getConnectionInfo(): ConnectionInfo;
|
||||
|
||||
registerTool(name: string, description: string, schema: ToolInputSchema, executeFn: ToolHandler): void;
|
||||
unregisterTool(name: string): void;
|
||||
unregisterAllTools(): void;
|
||||
|
||||
registerPrompt(name: string, description: string, args: PromptArgument[], executeFn: PromptHandler): void;
|
||||
unregisterPrompt(name: string): void;
|
||||
|
||||
registerResource(name: string, description: string, options: ResourceOptions, provideFn: ResourceHandler): void;
|
||||
unregisterResource(name: string): void;
|
||||
}
|
||||
|
||||
export default WebMCP;
|
||||
export { WebMCP };
|
||||
Reference in New Issue
Block a user