This repository was archived by the owner on Feb 24, 2026. It is now read-only.
Fix self-service action creation when invocationMethod is provided as JSON string#53
Merged
Matanga1-2 merged 13 commits intomainfrom Jul 1, 2025
Merged
Fix self-service action creation when invocationMethod is provided as JSON string#53Matanga1-2 merged 13 commits intomainfrom
Matanga1-2 merged 13 commits intomainfrom
Conversation
Co-authored-by: Matanga1-2 <24847398+Matanga1-2@users.noreply.github.com>
Co-authored-by: Matanga1-2 <24847398+Matanga1-2@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Self-service action creation sometimes fails
Fix self-service action creation when invocationMethod is provided as JSON string
Jun 26, 2025
Matanga1-2
suggested changes
Jun 29, 2025
Collaborator
Matanga1-2
left a comment
There was a problem hiding this comment.
It works better now, as the input generated by Claude is transformed to a correct one in Port.
Please
- Consider if there is also a required change to prevent the AI from generating the bad input to start with (maybe in the tool description? properties?)
- Upsert the version in pyproject.toml and add a new changelog entry
…ring fix Co-authored-by: Matanga1-2 <24847398+Matanga1-2@users.noreply.github.com>
Contributor
Author
I've addressed both points:
Changes are in commit 2b5fb4d. |
Matanga1-2
approved these changes
Jul 1, 2025
This reverts commit 5a7d6a6.
danielsinai
approved these changes
Jul 1, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Problem
When using Claude via the MCP server to create self-service actions, the action creation was failing because the
invocationMethodfield was being passed as a JSON string instead of a proper JSON object. This caused Pydantic validation to fail since it expected one of the specificActionInvocationMethodunion types (WEBHOOK, GITHUB, GITLAB, etc.), not a string.Example of the problematic input:
{ "invocationMethod": "{\"type\": \"WEBHOOK\", \"url\": \"https://...\", \"method\": \"POST\"}" }Should be:
{ "invocationMethod": {"type": "WEBHOOK", "url": "https://...", "method": "POST"} }Solution
Added field validation and model validation to the
CreateActionToolSchemaclass that:invocation_methodis provided as a JSON string and parses it into a dictionaryinvocationMethodalias and parses JSON strings at the model levelChanges
CreateActionToolSchemawith@field_validatorand@model_validatordecoratorsinvocationMethodandinvocation_methodfield namesTesting
Added test cases that verify:
The fix is minimal and surgical - it only adds the necessary validation to handle the specific Claude integration issue without affecting any other functionality.
Fixes #52.
💬 Share your feedback on Copilot coding agent for the chance to win a $200 gift card! Click here to start the survey.