0173e40a20
## Summary This PR enables serverless functions to be exposed as AI tools, allowing them to be used by AI agents. ### Changes - Added new `SERVERLESS_FUNCTION` tool category - Added `toolDescription`, `toolInputSchema`, and `toolOutputSchema` fields to serverless functions - Created database migration for the new schema columns - Added tool index query and resolver for fetching available tools - Added Settings AI page tabs (Skills, Tools, Settings) with new tools table - Added utility to convert tool schema to JSON schema format - Updated frontend to display tools in the settings page ### Implementation Details - Serverless functions can now define tool metadata (description, input/output schemas) - These functions are automatically registered in the tool registry - The tool index endpoint allows querying available tools with their schemas - Settings page now has a dedicated Tools tab showing all available tools
29 lines
683 B
TypeScript
29 lines
683 B
TypeScript
import { useApolloCoreClient } from '@/object-metadata/hooks/useApolloCoreClient';
|
|
import { GET_TOOL_INDEX } from '@/ai/graphql/queries/getToolIndex';
|
|
import { useQuery } from '@apollo/client';
|
|
|
|
type ToolIndexEntry = {
|
|
name: string;
|
|
description: string;
|
|
category: string;
|
|
objectName?: string;
|
|
};
|
|
|
|
type GetToolIndexQuery = {
|
|
getToolIndex: ToolIndexEntry[];
|
|
};
|
|
|
|
export const useGetToolIndex = () => {
|
|
const apolloMetadataClient = useApolloCoreClient();
|
|
|
|
const { data, loading, error } = useQuery<GetToolIndexQuery>(GET_TOOL_INDEX, {
|
|
client: apolloMetadataClient ?? undefined,
|
|
});
|
|
|
|
return {
|
|
toolIndex: data?.getToolIndex ?? [],
|
|
loading,
|
|
error,
|
|
};
|
|
};
|