(toolId: string)
| 7 | * Pure string utility — no server dependencies, safe to import in client components. |
| 8 | */ |
| 9 | export function normalizeToolId(toolId: string): string { |
| 10 | if (toolId.startsWith('workflow_executor_') && toolId.length > 'workflow_executor_'.length) { |
| 11 | return 'workflow_executor' |
| 12 | } |
| 13 | |
| 14 | const knowledgeOps = ['knowledge_search', 'knowledge_upload_chunk', 'knowledge_create_document'] |
| 15 | for (const op of knowledgeOps) { |
| 16 | if (toolId.startsWith(`${op}_`) && toolId.length > op.length + 1) { |
| 17 | return op |
| 18 | } |
| 19 | } |
| 20 | |
| 21 | const tableOps = [ |
| 22 | 'table_query_rows', |
| 23 | 'table_insert_row', |
| 24 | 'table_batch_insert_rows', |
| 25 | 'table_update_row', |
| 26 | 'table_update_rows_by_filter', |
| 27 | 'table_delete_rows_by_filter', |
| 28 | 'table_upsert_row', |
| 29 | 'table_get_row', |
| 30 | 'table_delete_row', |
| 31 | 'table_get_schema', |
| 32 | ] |
| 33 | for (const op of tableOps) { |
| 34 | if (toolId.startsWith(`${op}_`) && toolId.length > op.length + 1) { |
| 35 | return op |
| 36 | } |
| 37 | } |
| 38 | |
| 39 | return toolId |
| 40 | } |
no outgoing calls
no test coverage detected