@@ -24,12 +24,7 @@ import {
2424 getMcpToolIssue as validateMcpTool ,
2525} from '@/lib/mcp/tool-validation'
2626import type { McpToolSchema } from '@/lib/mcp/types'
27- import {
28- getCanonicalScopesForProvider ,
29- getProviderIdFromServiceId ,
30- type OAuthProvider ,
31- type OAuthService ,
32- } from '@/lib/oauth'
27+ import { getProviderIdFromServiceId , type OAuthProvider , type OAuthService } from '@/lib/oauth'
3328import { extractInputFieldsFromBlocks } from '@/lib/workflows/input-format'
3429import { useUserPermissionsContext } from '@/app/workspace/[workspaceId]/providers/workspace-permissions-provider'
3530import {
@@ -1414,16 +1409,6 @@ export const ToolInput = memo(function ToolInput({
14141409 isToolAlreadySelected ,
14151410 ] )
14161411
1417- const toolRequiresOAuth = ( toolId : string ) : boolean => {
1418- const toolParams = getToolParametersConfig ( toolId )
1419- return toolParams ?. toolConfig ?. oauth ?. required || false
1420- }
1421-
1422- const getToolOAuthConfig = ( toolId : string ) => {
1423- const toolParams = getToolParametersConfig ( toolId )
1424- return toolParams ?. toolConfig ?. oauth
1425- }
1426-
14271412 return (
14281413 < div className = 'w-full space-y-[8px]' >
14291414 < Combobox
@@ -1537,16 +1522,11 @@ export const ToolInput = memo(function ToolInput({
15371522 ? subBlocksResult ! . subBlocks
15381523 : [ ]
15391524
1540- const requiresOAuth =
1541- ! isCustomTool && ! isMcpTool && currentToolId && toolRequiresOAuth ( currentToolId )
1542- const oauthConfig =
1543- ! isCustomTool && ! isMcpTool && currentToolId ? getToolOAuthConfig ( currentToolId ) : null
1544-
15451525 const hasOperations = ! isCustomTool && ! isMcpTool && hasMultipleOperations ( tool . type )
15461526 const hasParams = useSubBlocks
15471527 ? displaySubBlocks . length > 0
15481528 : displayParams . filter ( ( param ) => evaluateParameterCondition ( param , tool ) ) . length > 0
1549- const hasToolBody = hasOperations || ( requiresOAuth && oauthConfig ) || hasParams
1529+ const hasToolBody = hasOperations || hasParams
15501530
15511531 const isExpandedForDisplay = hasToolBody
15521532 ? isPreview
@@ -1746,39 +1726,6 @@ export const ToolInput = memo(function ToolInput({
17461726 { ( ( ) => {
17471727 const renderedElements : React . ReactNode [ ] = [ ]
17481728
1749- const showOAuth =
1750- requiresOAuth && oauthConfig && tool . params ?. authMethod !== 'bot_token'
1751-
1752- const renderOAuthAccount = ( ) : React . ReactNode => {
1753- if ( ! showOAuth || ! oauthConfig ) return null
1754- const credentialSubBlock = toolBlock ?. subBlocks ?. find (
1755- ( s ) => s . type === 'oauth-input'
1756- )
1757- return (
1758- < div key = 'oauth-account' className = 'relative min-w-0 space-y-[6px]' >
1759- < div className = 'font-medium text-[13px] text-[var(--text-primary)]' >
1760- { credentialSubBlock ?. title || 'Account' } { ' ' }
1761- < span className = 'ml-0.5' > *</ span >
1762- </ div >
1763- < div className = 'w-full min-w-0' >
1764- < ToolCredentialSelector
1765- value = { tool . params ?. credential || '' }
1766- onChange = { ( value : string ) =>
1767- handleParamChange ( toolIndex , 'credential' , value )
1768- }
1769- provider = { oauthConfig . provider as OAuthProvider }
1770- requiredScopes = {
1771- credentialSubBlock ?. requiredScopes ||
1772- getCanonicalScopesForProvider ( oauthConfig . provider )
1773- }
1774- serviceId = { oauthConfig . provider }
1775- disabled = { disabled }
1776- />
1777- </ div >
1778- </ div >
1779- )
1780- }
1781-
17821729 const renderSubBlock = ( sb : BlockSubBlockConfig ) : React . ReactNode => {
17831730 const effectiveParamId = sb . id
17841731 const canonicalId = toolCanonicalIndex ?. canonicalIdBySubBlockId [ sb . id ]
@@ -1848,44 +1795,8 @@ export const ToolInput = memo(function ToolInput({
18481795 } )
18491796 )
18501797
1851- type RenderItem =
1852- | { kind : 'subblock' ; sb : BlockSubBlockConfig }
1853- | { kind : 'oauth' }
1854-
1855- const renderOrder : RenderItem [ ] = displaySubBlocks . map ( ( sb ) => ( {
1856- kind : 'subblock' as const ,
1857- sb,
1858- } ) )
1859-
1860- if ( showOAuth ) {
1861- const credentialIdx = allBlockSubBlocks . findIndex (
1862- ( sb ) => sb . type === 'oauth-input'
1863- )
1864- if ( credentialIdx >= 0 ) {
1865- const sbPositions = new Map ( allBlockSubBlocks . map ( ( sb , i ) => [ sb . id , i ] ) )
1866- const insertAt = renderOrder . findIndex (
1867- ( item ) =>
1868- item . kind === 'subblock' &&
1869- ( sbPositions . get ( item . sb . id ) ?? Number . POSITIVE_INFINITY ) >
1870- credentialIdx
1871- )
1872- if ( insertAt === - 1 ) {
1873- renderOrder . push ( { kind : 'oauth' } )
1874- } else {
1875- renderOrder . splice ( insertAt , 0 , { kind : 'oauth' } )
1876- }
1877- } else {
1878- renderOrder . unshift ( { kind : 'oauth' } )
1879- }
1880- }
1881-
1882- for ( const item of renderOrder ) {
1883- if ( item . kind === 'oauth' ) {
1884- const el = renderOAuthAccount ( )
1885- if ( el ) renderedElements . push ( el )
1886- } else {
1887- renderedElements . push ( renderSubBlock ( item . sb ) )
1888- }
1798+ for ( const sb of displaySubBlocks ) {
1799+ renderedElements . push ( renderSubBlock ( sb ) )
18891800 }
18901801
18911802 const uncoveredParams = displayParams . filter (
@@ -1924,11 +1835,6 @@ export const ToolInput = memo(function ToolInput({
19241835 )
19251836 }
19261837
1927- {
1928- const el = renderOAuthAccount ( )
1929- if ( el ) renderedElements . push ( el )
1930- }
1931-
19321838 const filteredParams = displayParams . filter ( ( param ) =>
19331839 evaluateParameterCondition ( param , tool )
19341840 )
0 commit comments