get_ansible_module_info
Retrieve Ansible module documentation and schema details to understand module functionality and parameters for Infrastructure-as-Code automation.
Instructions
Retrieve comprehensive information about an Ansible module including schema and documentation
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| collection_name | Yes | Name of the Ansible collection | |
| module_name | Yes | Name of the module |
Implementation Reference
- Main handler function that implements the core logic for the get_ansible_module_info tool. Fetches module data from the database and returns formatted text output including schema.async def handle_get_ansible_module_info( db: Any, arguments: Dict[str, Any], operation_id: str ) -> list[types.TextContent | types.ImageContent | types.EmbeddedResource]: """Handle get_ansible_module_info tool.""" try: logger.info( "Getting Ansible module info", extra={ "collection_name": arguments["collection_name"], "module_name": arguments["module_name"], "operation_id": operation_id, }, ) # Get module info module = get_module_by_name( db, arguments["collection_name"], arguments["module_name"] ) if not module: raise McpError( types.ErrorData( code=types.METHOD_NOT_FOUND, message=f"Module '{arguments['module_name']}' not found in collection '{arguments['collection_name']}'", data={ "tool": "get_ansible_module_info", "collection": arguments["collection_name"], "module": arguments["module_name"], "operation_id": operation_id, }, ) ) # Format output output = [ f"Module: {module['name']}", f"Collection: {module['collection_name']} v{module['collection_version']}", f"Type: {module['type']}", f"Version: {module['version']}", f"Documentation: {module['doc_url']}", "\nSchema:", module["schema"], ] return [TextContent(type="text", text="\n".join(output))] except Exception as e: error_msg = f"Failed to get module info: {str(e)}" logger.error(error_msg, extra={"operation_id": operation_id}) raise McpError( types.ErrorData( code=types.INTERNAL_ERROR, message=error_msg, data={ "tool": "get_ansible_module_info", "operation_id": operation_id, }, ) )
- JSON schema defining the input parameters for the get_ansible_module_info tool (collection_name and module_name)."get_ansible_module_info": { "type": "object", "description": "Retrieve comprehensive information about an Ansible module including schema and documentation", "required": ["collection_name", "module_name"], "properties": { "collection_name": { "type": "string", "description": "Name of the Ansible collection", }, "module_name": {"type": "string", "description": "Name of the module"}, }, },
- src/iac_memory_mcp_server/tools/ansible.py:473-482 (registration)Registration of the tool handler in the ansible_tool_handlers dictionary, mapping 'get_ansible_module_info' to its handler function.ansible_tool_handlers = { "get_ansible_collection_info": handle_get_ansible_collection_info, "list_ansible_collections": handle_list_ansible_collections, "get_collection_version_history": handle_get_collection_version_history, "get_ansible_module_info": handle_get_ansible_module_info, "list_collection_modules": handle_list_collection_modules, "get_module_version_compatibility": handle_get_module_version_compatibility, "add_ansible_collection": handle_add_ansible_collection, "add_ansible_module": handle_add_ansible_module, }