Skip to content

feat(tools_api): add upsert support to create_tool_from_schema - #45

Merged
phartenfeller merged 18 commits into
United-Codes:developmentfrom
konradszymanski:feat/tools-api-upsert
Apr 13, 2026
Merged

feat(tools_api): add upsert support to create_tool_from_schema#45
phartenfeller merged 18 commits into
United-Codes:developmentfrom
konradszymanski:feat/tools-api-upsert

Conversation

@konradszymanski

Copy link
Copy Markdown
Contributor

create_tool_from_schema now updates existing tools instead of failing on unique constraint.

Problem:
When calling create_tool_from_schema with an existing tool code, it failed with:
ORA-00001: unique constraint (KS.UC_AI_TOOLS_UK) violated on table KS.UC_AI_TOOLS columns (CODE)

Solution:

Check if tool with same code exists before insert
If exists: update the tool record, delete and recreate parameters and tags
If not exists: create new tool as before
Use Case:
Users may call uc_ai_tools_api.create_tool_from_schema multiple times to quickly update parameter values, tool instructions, or other tool configuration without needing to manually delete the tool first.

Changes:

uc_ai_tools_api.pkb: Added upsert logic to create_tool_from_schema
uc_ai_tools_api.pks: Updated documentation to reflect new behavior

@phartenfeller
phartenfeller merged commit 462b651 into United-Codes:development Apr 13, 2026
1 check failed
@phartenfeller

Copy link
Copy Markdown
Member

Sorry for getting back so late.

I like and see the need for an upsert prc. I decided that I prefer to keep create_tool_from_schema as it was before to keep the API stable. But included your changes as as seperate merge_tool_from_schema prc.

Thank you very much for the contribution!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants