@directus/api
Version:
Directus is a real-time API and App dashboard for managing SQL database content
101 lines (100 loc) • 3.24 kB
TypeScript
import { Server } from '@modelcontextprotocol/sdk/server/index.js';
import { type GetPromptResult } from '@modelcontextprotocol/sdk/types.js';
import type { Request, Response } from 'express';
import type { ToolConfig, ToolResult } from '../tools/types.js';
import type { MCPOptions } from './types.js';
export declare class DirectusMCP {
promptsCollection?: string | null;
systemPrompt?: string | null;
systemPromptEnabled?: boolean;
server: Server;
allowDeletes?: boolean;
constructor(options?: MCPOptions);
/**
* This handleRequest function is not awaiting lower level logic resulting in the actual
* response being an asynchronous side effect happening after the function has returned
*/
handleRequest(req: Request, res: Response): void;
buildURL(tool: ToolConfig<unknown>, input: unknown, data: unknown): string | undefined;
toPromptResponse(result: {
description?: string | undefined;
messages: GetPromptResult['messages'];
}): GetPromptResult;
toToolResponse(result?: ToolResult): {
[x: string]: unknown;
content: ({
type: "text";
text: string;
_meta?: {
[x: string]: unknown;
} | undefined;
} | {
type: "image";
data: string;
mimeType: string;
_meta?: {
[x: string]: unknown;
} | undefined;
} | {
type: "audio";
data: string;
mimeType: string;
_meta?: {
[x: string]: unknown;
} | undefined;
} | {
uri: string;
name: string;
type: "resource_link";
description?: string | undefined;
mimeType?: string | undefined;
_meta?: {
[x: string]: unknown;
} | undefined;
icons?: {
src: string;
mimeType?: string | undefined;
sizes?: string[] | undefined;
}[] | undefined;
title?: string | undefined;
} | {
type: "resource";
resource: {
uri: string;
text: string;
mimeType?: string | undefined;
_meta?: {
[x: string]: unknown;
} | undefined;
} | {
uri: string;
blob: string;
mimeType?: string | undefined;
_meta?: {
[x: string]: unknown;
} | undefined;
};
_meta?: {
[x: string]: unknown;
} | undefined;
})[];
_meta?: {
[x: string]: unknown;
"io.modelcontextprotocol/related-task"?: {
[x: string]: unknown;
taskId: string;
} | undefined;
} | undefined;
structuredContent?: {
[x: string]: unknown;
} | undefined;
isError?: boolean | undefined;
};
toExecutionError(err: unknown): {
isError: boolean;
content: {
type: "text";
text: string;
}[];
};
}