Skip to content

Conversation

@mandar242
Copy link
Contributor

SUMMARY

https://issues.redhat.com/browse/ACA-4359

This PR adds run_tool plugin

ISSUE TYPE
  • Bugfix Pull Request
  • Docs Pull Request
  • Feature Pull Request
  • New Module Pull Request
COMPONENT NAME
ADDITIONAL INFORMATION

@softwarefactory-project-zuul
Copy link
Contributor

@@ -0,0 +1,2 @@
# required for aws mcp server
uvx
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
uvx
uv

(uvx is a command provided by the uv package)

@softwarefactory-project-zuul
Copy link
Contributor

@mandar242
Copy link
Contributor Author

recheck

@softwarefactory-project-zuul
Copy link
Contributor

Build failed.
https://ansible.softwarefactory-project.io/zuul/buildset/246799bde58f49b28895ac1cef463ebf

build-ansible-collection FAILURE in 5m 24s
⚠️ integration-ansible-mcp SKIPPED Skipped due to failed job build-ansible-collection

@mandar242
Copy link
Contributor Author

recheck

@softwarefactory-project-zuul
Copy link
Contributor


return result

def _validate_connection(self):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wouldn't make sense to move this into a shared utility, since this is something needed for all the action plugins?

result["changed"] = False
result["content"] = content

if is_error or "isError" in response:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I do think you can only keep if is_error: because it already checks if isError is within response.

if "structured_content" in response:
result["structured_content"] = response["structured_content"]

if is_error:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Doesn't make sense to move the content inside this check into line 82 https://github.com/ansible-collections/ansible.mcp/pull/15/files#diff-31f027eeccd858f79f892e99407fcd14a25b488202356001ae82cb8e50908523R82? You are already checking if is_error: at that line.


# Validate connection
if error := self._validate_connection():
result["failed"] = True
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You could also define a dataclass for the returned result.

f"Parameter 'args' must be a dictionary, got {type(tool_args).__name__}",
)

return tool_name, tool_args, None
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I do think for type hinting consistency, this should be probably an empty string. But I also do think, using a dedicated datatype will help.

conn = Connection(self._connection.socket_path)
return conn.call_tool(tool_name, **tool_args)

def _populate_result(self, result, response, tool_name):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you also please ensure type hinting is used and same for docstrings?

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.

3 participants