import React, { useEffect, useState } from 'react'; import { SkeletonCard } from './McpUi'; import { toast } from 'react-toastify'; import { mcpApi, t } from './api'; const kindOf = ( annotations: any ): [ string, string ] => { if ( annotations && annotations.readonly ) { return [ 'read', t( 'mcp-kind-read', 'Read-only' ) ]; } if ( annotations && annotations.destructive ) { return [ 'destructive', t( 'mcp-kind-confirm', 'Needs confirmation' ) ]; } return [ 'write', t( 'mcp-kind-write', 'Changes data' ) ]; }; /** * Section 5: Registered abilities (MCP tools). */ const McpAbilities = ( { refreshKey }: { refreshKey: number } ) => { const [ data, setData ] = useState< any >( null ); const [ open, setOpen ] = useState< string >( '' ); useEffect( () => { mcpApi( 'abilities' ) .then( setData ) .catch( ( e ) => toast.error( e.message ) ); }, [ refreshKey ] ); if ( ! data ) { return ; } return (

{ t( 'mcp-abilities', 'Available tools' ) }

{ data.enabled ? `${ data.flextable } ${ t( 'mcp-abilities-count', 'FlexTable abilities are registered on this site' ) } (${ data.total } ${ t( 'mcp-abilities-total', 'abilities in total' ) }). ` : t( 'mcp-abilities-off', 'Abilities are registered when MCP is on. Reload this page after turning it on.' ) }

{ data.abilities.length > 0 && ( ) }
); }; export default McpAbilities;